engeom 0.2.4__cp38-abi3-win_amd64.whl → 0.2.6__cp38-abi3-win_amd64.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,3 +1,7 @@
1
+ """
2
+ This module contains classes which represent measurements, such as distances, angles, and GD&T features.
3
+
4
+ """
1
5
  from ..engeom import _metrology
2
6
 
3
7
  # Global import of all functions
engeom/metrology.pyi CHANGED
@@ -1,64 +1,137 @@
1
- from .geom2 import Point2, Vector2, SurfacePoint2
2
- from .geom3 import Point3, Vector3, SurfacePoint3
1
+ class Distance2:
2
+ """
3
+ Represents a distance between two points in 2D space.
4
+ """
3
5
 
6
+ from .geom2 import Point2, Vector2, SurfacePoint2
7
+ from .geom3 import Iso3
4
8
 
5
- class Length2:
6
9
  def __init__(self, a: Point2, b: Point2, direction: Vector2 | None = None):
7
10
  """
8
-
9
- :param a:
10
- :param b:
11
- :param direction:
11
+ Initialize a new 2D distance object.
12
+ :param a: The first point in the distance calculation.
13
+ :param b: The second point in the distance calculation.
14
+ :param direction: The direction of the distance calculation. If not provided, the direction will be calculated
15
+ automatically as the vector `b - a`.
12
16
  """
13
17
  ...
14
18
 
15
19
  @property
16
20
  def a(self) -> Point2:
21
+ """
22
+ Get the first point in the distance calculation.
23
+ :return: The first point
24
+ """
17
25
  ...
18
26
 
19
27
  @property
20
28
  def b(self) -> Point2:
29
+ """
30
+ Get the second point in the distance calculation.
31
+ :return: The second point
32
+ """
21
33
  ...
22
34
 
23
35
  @property
24
36
  def direction(self) -> Vector2:
37
+ """
38
+ Get the direction of the distance calculation.
39
+ :return: The direction vector
40
+ """
25
41
  ...
26
42
 
27
43
  @property
28
44
  def value(self) -> float:
45
+ """
46
+ Get the signed distance scalar value.
47
+ :return: the signed distance
48
+ """
29
49
  ...
30
50
 
31
51
  @property
32
52
  def center(self) -> SurfacePoint2:
53
+ """
54
+ Get a center surface point, located halfway between the `a` and `b` points and with a normal facing the
55
+ `direction` vector.
56
+ :return: the center surface point
57
+ """
58
+ ...
59
+
60
+ def to_3d(self, iso: Iso3) -> Distance3:
61
+ """
62
+ Convert this 2D distance to a 3D distance by adding a zero Z component to the points and direction and then
63
+ transforming them using the provided isometry.
64
+ :param iso: The isometry to transform the entity by after adding a zero Z component.
65
+ :return: The 3D distance object
66
+ """
33
67
  ...
34
68
 
35
69
 
36
- class Length3:
70
+ class Distance3:
71
+ """
72
+ Represents a distance between two points in 3D space.
73
+ """
74
+
75
+ from .geom3 import Point3, Vector3, SurfacePoint3, Iso3
76
+
37
77
  def __init__(self, a: Point3, b: Point3, direction: Vector3 | None = None):
38
78
  """
39
-
40
- :param a:
41
- :param b:
42
- :param direction:
79
+ Initialize a new 3D distance object.
80
+ :param a: The first point in the distance calculation.
81
+ :param b: The second point in the distance calculation.
82
+ :param direction: The direction of the distance calculation. If not provided, the direction will be calculated
83
+ automatically as the vector `b - a`.
43
84
  """
44
85
  ...
45
86
 
46
87
  @property
47
88
  def a(self) -> Point3:
89
+ """
90
+ Get the first point in the distance calculation.
91
+ :return: The first point
92
+ """
48
93
  ...
49
94
 
50
95
  @property
51
96
  def b(self) -> Point3:
97
+ """
98
+ Get the second point in the distance calculation.
99
+ :return: The second point
100
+ """
52
101
  ...
53
102
 
54
103
  @property
55
104
  def direction(self) -> Vector3:
105
+ """
106
+ Get the direction of the distance calculation.
107
+ :return: The direction vector
108
+ """
56
109
  ...
57
110
 
58
111
  @property
59
112
  def value(self) -> float:
113
+ """
114
+ Get the signed distance scalar value.
115
+ :return: the signed distance
116
+ """
60
117
  ...
61
118
 
62
119
  @property
63
120
  def center(self) -> SurfacePoint3:
121
+ """
122
+ Get a center surface point, located halfway between the `a` and `b` points and with a normal facing the
123
+ `direction` vector.
124
+ :return: the center surface point
125
+ """
126
+ ...
127
+
128
+ def to_2d(self, iso: Iso3) -> Distance2:
129
+ """
130
+ Convert this 3D distance to a 2D distance by transforming the points and direction using the provided isometry
131
+ and then removing the Z component.
132
+
133
+ :param iso: The isometry to transform the entity by before removing the Z component.
134
+ :return: The 2D distance object
135
+ """
64
136
  ...
137
+
engeom/plot.py ADDED
@@ -0,0 +1,26 @@
1
+ """
2
+ This module contains tools to help with the plotting of geometry and other visual elements using optional plotting
3
+ libraries.
4
+
5
+ Currently, the following plotting libraries are supported:
6
+
7
+ * **PyVista**: A 3D visualization library that is built on top of VTK and provides tools for both interactive and
8
+ static 3D rendering. The `PyvistaPlotterHelper` can wrap around a PyVista `Plotter` object to provide direct
9
+ functionality for plotting some `engeom` entities.
10
+
11
+ * **Matplotlib**: A 2D plotting library that is widely used for creating static plots. The `MatplotlibAxesHelper` class
12
+ can wrap around a Matplotlib `Axes` object to provide direct functionality for plotting some `engeom` entities, while
13
+ also forcing the aspect ratio to be 1:1 and expanding the plot to fill all available space.
14
+ """
15
+
16
+ from ._plot import LabelPlace
17
+
18
+ try:
19
+ from ._plot.pyvista import PyvistaPlotterHelper
20
+ except ImportError:
21
+ pass
22
+
23
+ try:
24
+ from ._plot.matplotlib import GOM_CMAP, GomColorMap, MatplotlibAxesHelper
25
+ except ImportError:
26
+ pass
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: engeom
3
- Version: 0.2.4
3
+ Version: 0.2.6
4
4
  Classifier: Programming Language :: Rust
5
5
  Classifier: Programming Language :: Python :: Implementation :: CPython
6
6
  Classifier: Programming Language :: Python :: Implementation :: PyPy
@@ -8,3 +8,9 @@ Requires-Dist: numpy
8
8
  Requires-Dist: pytest ; extra == 'tests'
9
9
  Provides-Extra: tests
10
10
  Requires-Python: >=3.8
11
+ Description-Content-Type: text/markdown; charset=UTF-8; variant=GFM
12
+
13
+ # Engeom Python Bindings
14
+
15
+ Full documentation at https://mattj23.github.io/py-engeom/
16
+
@@ -0,0 +1,21 @@
1
+ engeom-0.2.6.dist-info/METADATA,sha256=aqce3m62liXB0MztwOC5080-cbITJFeO7zYfDYGIS24,497
2
+ engeom-0.2.6.dist-info/WHEEL,sha256=_g1M2QM3kt1Ssm_sHOg_3TUY7GxNE2Ueyslb9ZDtPwk,94
3
+ engeom/airfoil/__init__.py,sha256=gpS9pVepUu90XJ-ePndNupbUMKI0RGxNXPxD9x0iVHY,274
4
+ engeom/airfoil.pyi,sha256=VTeJBoS9Iij7p-92R7jCqzPasHmvAUocyzc6BSx7mvM,23557
5
+ engeom/align/__init__.py,sha256=SEeMqeqLKqJC73Mg8GwPwd9NwWnl-dcCqJ4rPdh8yyc,196
6
+ engeom/align.pyi,sha256=QCSKrTLkCoaIubcrPU9J-wDZe1lRP0GbPgWZmonXjo0,997
7
+ engeom/engeom.pyi,sha256=J0L_D-Sc2laJHL36nUAvIP3eN9BDryAxd_6aMQarlZc,1561
8
+ engeom/geom2/__init__.py,sha256=JFpiLyROUh6vyakG-7JDSlCMCn4QB2MQ8bz3uVCaAIk,373
9
+ engeom/geom2.pyi,sha256=508YJVNAJcZxEIZcWi4upcGtiZKoRnGtAW7TfTU3b3A,42922
10
+ engeom/geom3/__init__.py,sha256=l8B0iDhJ4YiRbslJLN791XWai2DWrpmZptnzIETMS9g,370
11
+ engeom/geom3.pyi,sha256=ZW37Pg2SLA74RTUmz0Ac82UmLTFm6K9BSHG_rWeX-Ro,55237
12
+ engeom/metrology/__init__.py,sha256=XvEhG8uDm1olWwZHDDrQv9LFP5zXhbsGx27PqRq8WE0,304
13
+ engeom/metrology.pyi,sha256=9I5un86VB_2gmQBrVYhX8JzILTUADMLB9Em8ttJxrWg,4044
14
+ engeom/plot.py,sha256=2b81-dW7aKKC1TjoDtRmppFKpzQOia7w6c4T2pExN0E,1065
15
+ engeom/_plot/common.py,sha256=Py78ufN3yi59hPwv21SoGcqyZUJS-_PmK8tlAKgSG7Q,517
16
+ engeom/_plot/matplotlib.py,sha256=tTk4Fu6hDVxP1655koeT9B0JxkoURTr30ZyBV_jzTi8,11643
17
+ engeom/_plot/pyvista.py,sha256=-G7ZxJQVfLLsVQP03jRRuu-F3Gq3bQxectBVS2L-bdk,10454
18
+ engeom/_plot/__init__.py,sha256=F_KviZtxzZGwfEjjn8Ep46N4UVl8VpFJWBzbBUE_J7A,30
19
+ engeom/__init__.py,sha256=kYgFq3jq1quDfV013wEYQMlUBz4QNSpP6u8lFiuTHvc,115
20
+ engeom/engeom.pyd,sha256=L2iZitssfZ7lOhznzT3RDlwPD-xlViKtulDIdrS8K9M,2335744
21
+ engeom-0.2.6.dist-info/RECORD,,
engeom/pyvista.py DELETED
@@ -1,178 +0,0 @@
1
- """
2
- This module contains helper functions for working with PyVista.
3
- """
4
-
5
- from __future__ import annotations
6
-
7
- from typing import List, Any, Dict, Union, Iterable, Tuple
8
-
9
- import numpy
10
- from pyvista import ColorLike
11
-
12
- from .geom3 import Mesh, Curve3, Vector3, Point3, Iso3
13
- from .metrology import Length3
14
- from .matplotlib import LabelPlace
15
-
16
- PlotCoords = Union[Point3, Vector3, Iterable[float]]
17
-
18
- try:
19
- import pyvista
20
- except ImportError:
21
- pass
22
- else:
23
-
24
- class PlotterHelper:
25
- def __init__(self, plotter: pyvista.Plotter):
26
- self.plotter = plotter
27
-
28
- def add_curves(
29
- self,
30
- *curves: Curve3,
31
- color: ColorLike = "w",
32
- width: float = 5.0,
33
- label: str | None = None,
34
- name: str | None = None,
35
- ) -> List[pyvista.vtkActor]:
36
- """
37
-
38
- :param curves:
39
- :param color:
40
- :param width:
41
- :param label:
42
- :param name:
43
- :return:
44
- """
45
- result_list = []
46
- for curve in curves:
47
- added = self.plotter.add_lines(
48
- curve.points,
49
- connected=True,
50
- color=color,
51
- width=width,
52
- label=label,
53
- name=name,
54
- )
55
- result_list.append(added)
56
-
57
- return result_list
58
-
59
- def add_mesh(self, mesh: Mesh, **kwargs) -> pyvista.vtkActor:
60
- """
61
-
62
- :param mesh:
63
- :return:
64
- """
65
- if "cmap" in kwargs:
66
- cmap_extremes = _cmap_extremes(kwargs["cmap"])
67
- kwargs.update(cmap_extremes)
68
-
69
- prefix = numpy.ones((mesh.faces.shape[0], 1), dtype=mesh.faces.dtype)
70
- faces = numpy.hstack((prefix * 3, mesh.faces))
71
- data = pyvista.PolyData(mesh.vertices, faces)
72
- return self.plotter.add_mesh(data, **kwargs)
73
-
74
- def dimension(
75
- self,
76
- length: Length3,
77
- template: str = "{value:.3f}",
78
- label_place: LabelPlace = LabelPlace.Outside,
79
- label_offset: float | None = None,
80
- text_size: int = 16,
81
- scale_value: float = 1.0,
82
- ):
83
- label_offset = label_offset or max(abs(length.value), 1.0) * 3
84
-
85
- t_a = length.center.scalar_projection(length.a)
86
- t_b = length.center.scalar_projection(length.b)
87
-
88
- outside = length.center.at_distance(max(t_a, t_b))
89
- inside = length.center.at_distance(min(t_a, t_b))
90
-
91
- circles = []
92
- builder = LineBuilder()
93
-
94
- builder.add(inside - length.direction * label_offset * 0.25)
95
- builder.add(inside)
96
- circles.append(inside)
97
- builder.skip()
98
-
99
- circles.append(outside)
100
- builder.add(outside)
101
- builder.add(outside + length.direction * label_offset)
102
-
103
- points = numpy.array([_tuplefy(p) for p in circles], dtype=numpy.float64)
104
- self.plotter.add_points(points, color="black", point_size=4, render_points_as_spheres=True)
105
-
106
- lines = builder.build()
107
- self.plotter.add_lines(lines, color="black", width=1.5)
108
-
109
- value = length.value * scale_value
110
- label = pyvista.Label(text=template.format(value=value), position=lines[-1], size=text_size)
111
- self.plotter.add_actor(label)
112
-
113
- def coordinate_frame(self, iso: Iso3, size: float = 1.0):
114
- points = numpy.array([[0, 0, 0], [size, 0, 0], [0, size, 0], [0, 0, size]], dtype=numpy.float64)
115
- points = iso.transform_points(points)
116
-
117
- self.plotter.add_lines(points[[0, 1]], color="red", width=5.0)
118
- self.plotter.add_lines(points[[0, 2]], color="green", width=5.0)
119
- self.plotter.add_lines(points[[0, 3]], color="blue", width=5.0)
120
-
121
- def label(self, point: PlotCoords, text: str, **kwargs):
122
- label = pyvista.Label(text=text, position=_tuplefy(point), **kwargs)
123
- self.plotter.add_actor(label)
124
-
125
- def arrow(self, start: PlotCoords, direction: PlotCoords,
126
- tip_length: float = 0.25,
127
- tip_radius: float = 0.1,
128
- shaft_radius: float = 0.05,
129
- **kwargs):
130
- pd = pyvista.Arrow(_tuplefy(start), _tuplefy(direction), tip_length=tip_length, tip_radius=tip_radius,
131
- shaft_radius=shaft_radius)
132
- self.plotter.add_mesh(pd, **kwargs, color="black")
133
-
134
-
135
- def _cmap_extremes(item: Any) -> Dict[str, ColorLike]:
136
- working = {}
137
- try:
138
- from matplotlib.colors import Colormap
139
- except ImportError:
140
- return working
141
- else:
142
- if isinstance(item, Colormap):
143
- over = getattr(item, "_rgba_over", None)
144
- under = getattr(item, "_rgba_under", None)
145
- if over is not None:
146
- working["above_color"] = over
147
- if under is not None:
148
- working["below_color"] = under
149
- return working
150
-
151
-
152
- class LineBuilder:
153
- def __init__(self):
154
- self.vertices = []
155
- self._skip = 1
156
-
157
- def add(self, points: PlotCoords):
158
- if self.vertices:
159
- if self._skip > 0:
160
- self._skip -= 1
161
- else:
162
- self.vertices.append(self.vertices[-1])
163
-
164
- self.vertices.append(_tuplefy(points))
165
-
166
- def skip(self):
167
- self._skip = 2
168
-
169
- def build(self) -> numpy.ndarray:
170
- return numpy.array(self.vertices, dtype=numpy.float64)
171
-
172
-
173
- def _tuplefy(item: PlotCoords) -> Tuple[float, float, float]:
174
- if isinstance(item, (Point3, Vector3)):
175
- return item.x, item.y, item.z
176
- else:
177
- x, y, z, *_ = item
178
- return x, y, z
@@ -1,18 +0,0 @@
1
- engeom-0.2.4.dist-info/METADATA,sha256=ihtRy0gEfQ1gc10xbpncuk_Uc_-ocxIR2HyZEejVXto,339
2
- engeom-0.2.4.dist-info/WHEEL,sha256=_g1M2QM3kt1Ssm_sHOg_3TUY7GxNE2Ueyslb9ZDtPwk,94
3
- engeom/airfoil/__init__.py,sha256=G6m7JEvHVk3sM2JooJPOg8JNA3VuEp0EIqczSEbC_PY,180
4
- engeom/airfoil.pyi,sha256=0TVpXkolFUXbBqJp93FenA_XqvU7FD1DnbncAF0ubow,14654
5
- engeom/align/__init__.py,sha256=SEeMqeqLKqJC73Mg8GwPwd9NwWnl-dcCqJ4rPdh8yyc,196
6
- engeom/align.pyi,sha256=QCSKrTLkCoaIubcrPU9J-wDZe1lRP0GbPgWZmonXjo0,997
7
- engeom/engeom.pyi,sha256=Jia11rU8ZnMKdlXgfGeBPlSmsYPEfALM-_ufNwR0ibQ,254
8
- engeom/geom2/__init__.py,sha256=mRu8Zh6DE-EQyhxScoxszPqDjGVzGWVJEQO6RIAtS4A,174
9
- engeom/geom2.pyi,sha256=Jh0ES-Gvkl7sFQV7VG6KdwgDbCPhmiETG_YOObYazhU,22741
10
- engeom/geom3/__init__.py,sha256=DG5jt2xgS9WRNb58ZkkrcKQQO6bIG-irg-uV_BkHEj4,174
11
- engeom/geom3.pyi,sha256=UUUg3OHobF_MfSDJZXD0PEZGSak2XQpiGAkne3lY7fI,34163
12
- engeom/matplotlib.py,sha256=A0gdQshzE3G7joNHna4viYnioQtA8LVXfSuZ_X6AHeo,9001
13
- engeom/metrology/__init__.py,sha256=cpsB0-hJGitzW79Coxwf7r_mpNaeI6yG3myDEVdBJgk,186
14
- engeom/metrology.pyi,sha256=P_2pkoLUAOB0-RKppj0FN01XGY0jx1lGw9H1eKXrW8s,1144
15
- engeom/pyvista.py,sha256=WVjaMG1hhd6hkknfxgkgCH8rZRXaM2AweG39T0UQkGc,6044
16
- engeom/__init__.py,sha256=kYgFq3jq1quDfV013wEYQMlUBz4QNSpP6u8lFiuTHvc,115
17
- engeom/engeom.pyd,sha256=7G9m_LBBIJkK7bVNkiV0Z6rQ0VA1R-KuVkZcB_w4rPE,2317312
18
- engeom-0.2.4.dist-info/RECORD,,
File without changes