engeom 0.2.7__cp38-abi3-win_amd64.whl → 0.2.9__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.
- engeom/_plot/matplotlib.py +50 -0
- engeom/_plot/pyvista.py +34 -5
- engeom/engeom.pyd +0 -0
- engeom/geom3.pyi +45 -0
- engeom/plot.py +1 -1
- {engeom-0.2.7.dist-info → engeom-0.2.9.dist-info}/METADATA +1 -1
- {engeom-0.2.7.dist-info → engeom-0.2.9.dist-info}/RECORD +8 -8
- {engeom-0.2.7.dist-info → engeom-0.2.9.dist-info}/WHEEL +0 -0
engeom/_plot/matplotlib.py
CHANGED
@@ -1,10 +1,13 @@
|
|
1
1
|
from typing import List, Iterable, Tuple, Union
|
2
2
|
import numpy
|
3
|
+
|
3
4
|
from .common import LabelPlace
|
4
5
|
from engeom.geom2 import Curve2, Circle2, Aabb2, Point2, Vector2, SurfacePoint2
|
6
|
+
from engeom.geom3 import Vector3, Mesh, Point3
|
5
7
|
from engeom.metrology import Distance2
|
6
8
|
|
7
9
|
PlotCoords = Union[Point2, Vector2, Iterable[float]]
|
10
|
+
PointLike = Union[Point2, Tuple[float, float], Point3]
|
8
11
|
|
9
12
|
try:
|
10
13
|
from matplotlib.pyplot import Axes, Circle
|
@@ -273,3 +276,50 @@ def _tuplefy(item: PlotCoords) -> Tuple[float, float]:
|
|
273
276
|
else:
|
274
277
|
x, y, *_ = item
|
275
278
|
return x, y
|
279
|
+
|
280
|
+
|
281
|
+
class TraceBuilder:
|
282
|
+
def __init__(self):
|
283
|
+
self.xs = []
|
284
|
+
self.ys = []
|
285
|
+
self.c = []
|
286
|
+
|
287
|
+
def bounds(self) -> Aabb2:
|
288
|
+
xs = [x for x in self.xs if x is not None]
|
289
|
+
ys = [y for y in self.ys if y is not None]
|
290
|
+
return Aabb2(
|
291
|
+
x_min=min(xs),
|
292
|
+
x_max=max(xs),
|
293
|
+
y_min=min(ys),
|
294
|
+
y_max=max(ys),
|
295
|
+
)
|
296
|
+
|
297
|
+
def add_segment(self, *points: PointLike):
|
298
|
+
self.add_points(*points)
|
299
|
+
self.add_blank()
|
300
|
+
|
301
|
+
def add_blank(self):
|
302
|
+
self.xs.append(None)
|
303
|
+
self.ys.append(None)
|
304
|
+
self.c.append(None)
|
305
|
+
|
306
|
+
def add_points(self, *points: PointLike):
|
307
|
+
for x, y, *_ in points:
|
308
|
+
self.xs.append(x)
|
309
|
+
self.ys.append(y)
|
310
|
+
|
311
|
+
def add_point_and_color(self, point: PointLike, color: float):
|
312
|
+
self.xs.append(point[0])
|
313
|
+
self.ys.append(point[1])
|
314
|
+
self.c.append(color)
|
315
|
+
|
316
|
+
def invert_y(self):
|
317
|
+
self.ys = [-y if y is not None else None for y in self.ys]
|
318
|
+
|
319
|
+
@property
|
320
|
+
def kwargs(self):
|
321
|
+
return dict(x=self.xs, y=self.ys)
|
322
|
+
|
323
|
+
@property
|
324
|
+
def xy(self):
|
325
|
+
return self.xs, self.ys
|
engeom/_plot/pyvista.py
CHANGED
@@ -176,19 +176,48 @@ else:
|
|
176
176
|
bold=False,
|
177
177
|
)
|
178
178
|
|
179
|
-
def coordinate_frame(self, iso
|
179
|
+
def coordinate_frame(self, iso, size: float = 1.0, line_width=3.0, label: str | None = None,
|
180
|
+
label_size: int = 12):
|
180
181
|
"""
|
181
182
|
Add a coordinate frame to the plotter. This will appear as three lines, with X in red, Y in green,
|
182
183
|
and Z in blue. The length of each line is determined by the `size` parameter.
|
183
|
-
:param iso: The isometry to use as the origin and orientation of the coordinate frame.
|
184
|
+
:param iso: The isometry to use as the origin and orientation of the coordinate frame. May be an `Iso3`, a
|
185
|
+
4x4 `numpy.ndarray` that validly converts into an `Iso3`, or anything with an `as_numpy` method that
|
186
|
+
returns a valid 4x4 `numpy.ndarray`.
|
184
187
|
:param size: The length of each line in the coordinate frame.
|
188
|
+
:param line_width: The width of the lines in the coordinate frame.
|
189
|
+
:param label: An optional label to display at the origin of the coordinate frame.
|
190
|
+
:param label_size: The size of the label text.
|
185
191
|
"""
|
192
|
+
if not isinstance(iso, Iso3):
|
193
|
+
if hasattr(iso, "as_numpy"):
|
194
|
+
iso = iso.as_numpy()
|
195
|
+
|
196
|
+
if isinstance(iso, numpy.ndarray):
|
197
|
+
if iso.shape == (4, 4):
|
198
|
+
iso = Iso3(iso)
|
199
|
+
else:
|
200
|
+
raise ValueError("Invalid shape for iso: expected (4, 4), got {iso.shape}")
|
201
|
+
else:
|
202
|
+
raise TypeError("Invalid type for iso: expected Iso3 or numpy.ndarray, got {type(iso)}")
|
203
|
+
|
186
204
|
points = numpy.array([[0, 0, 0], [size, 0, 0], [0, size, 0], [0, 0, size]], dtype=numpy.float64)
|
187
205
|
points = iso.transform_points(points)
|
188
206
|
|
189
|
-
self.plotter.add_lines(points[[0, 1]], color="red", width=
|
190
|
-
self.plotter.add_lines(points[[0, 2]], color="green", width=
|
191
|
-
self.plotter.add_lines(points[[0, 3]], color="blue", width=
|
207
|
+
self.plotter.add_lines(points[[0, 1]], color="red", width=line_width)
|
208
|
+
self.plotter.add_lines(points[[0, 2]], color="green", width=line_width)
|
209
|
+
self.plotter.add_lines(points[[0, 3]], color="blue", width=line_width)
|
210
|
+
|
211
|
+
if label:
|
212
|
+
self.plotter.add_point_labels(
|
213
|
+
[points[0]],
|
214
|
+
[label],
|
215
|
+
show_points=False,
|
216
|
+
background_color="white",
|
217
|
+
font_family="courier",
|
218
|
+
font_size=label_size,
|
219
|
+
bold=False,
|
220
|
+
)
|
192
221
|
|
193
222
|
def label(self, point: PlotCoords, text: str, **kwargs):
|
194
223
|
"""
|
engeom/engeom.pyd
CHANGED
Binary file
|
engeom/geom3.pyi
CHANGED
@@ -745,6 +745,25 @@ class Mesh:
|
|
745
745
|
"""
|
746
746
|
...
|
747
747
|
|
748
|
+
@property
|
749
|
+
def face_normals(self) -> NDArray[float]:
|
750
|
+
"""
|
751
|
+
Will return an immutable view of the face normals of the mesh as a numpy array of shape (m, 3), where m is the
|
752
|
+
number of triangles in the mesh.
|
753
|
+
:return: a numpy array of shape (m, 3) containing the normals of the triangles of the mesh.
|
754
|
+
"""
|
755
|
+
...
|
756
|
+
|
757
|
+
@property
|
758
|
+
def vertex_normals(self) -> NDArray[float]:
|
759
|
+
"""
|
760
|
+
Will return an immutable view of the vertex normals of the mesh as a numpy array of shape (n, 3), where n is the
|
761
|
+
number of vertices in the mesh. If a vertex has no faces, the normal will be (0, 0, 0), otherwise the normal
|
762
|
+
will have been averaged from the normals of the faces that share the vertex.
|
763
|
+
:return: a numpy array of shape (n, 3) containing the normals of the vertices of the mesh.
|
764
|
+
"""
|
765
|
+
...
|
766
|
+
|
748
767
|
@property
|
749
768
|
def faces(self) -> NDArray[numpy.uint32]:
|
750
769
|
"""
|
@@ -1282,3 +1301,29 @@ class Aabb3:
|
|
1282
1301
|
:return: a new AABB object with the shrunk bounds.
|
1283
1302
|
"""
|
1284
1303
|
...
|
1304
|
+
|
1305
|
+
|
1306
|
+
class RayBundle3:
|
1307
|
+
"""
|
1308
|
+
A class representing a bundle of rays in 3D space. The rays are represented by a set of origins and directions,
|
1309
|
+
which are used to define the rays.
|
1310
|
+
|
1311
|
+
This class is used for ray tracing operations, such as intersection tests with meshes or other geometric objects.
|
1312
|
+
"""
|
1313
|
+
|
1314
|
+
def __init__(self, array: NDArray[float]):
|
1315
|
+
"""
|
1316
|
+
Create a ray bundle from a numpy array of shape (n, 6) containing the origins and directions of the rays.
|
1317
|
+
:param array: a numpy array of shape (n, 6) containing the origins and directions of the rays.
|
1318
|
+
"""
|
1319
|
+
...
|
1320
|
+
|
1321
|
+
def intersect_mesh(self, mesh: Mesh, iso: Iso3 | None = None, angle: float | None = None) -> NDArray[float]:
|
1322
|
+
"""
|
1323
|
+
|
1324
|
+
:param angle:
|
1325
|
+
:param mesh:
|
1326
|
+
:param iso:
|
1327
|
+
:return:
|
1328
|
+
"""
|
1329
|
+
...
|
engeom/plot.py
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
engeom-0.2.
|
2
|
-
engeom-0.2.
|
1
|
+
engeom-0.2.9.dist-info/METADATA,sha256=ySmYFygY2YZDxjNhkPBFDEvrC-IkmqFjysrpHSdaq3E,497
|
2
|
+
engeom-0.2.9.dist-info/WHEEL,sha256=hKPP3BCTWtTwj6SFaSI--T5aOGqh_llYfbZ_BsqivwA,94
|
3
3
|
engeom/airfoil/__init__.py,sha256=gpS9pVepUu90XJ-ePndNupbUMKI0RGxNXPxD9x0iVHY,274
|
4
4
|
engeom/airfoil.pyi,sha256=VTeJBoS9Iij7p-92R7jCqzPasHmvAUocyzc6BSx7mvM,23557
|
5
5
|
engeom/align/__init__.py,sha256=SEeMqeqLKqJC73Mg8GwPwd9NwWnl-dcCqJ4rPdh8yyc,196
|
@@ -8,16 +8,16 @@ engeom/engeom.pyi,sha256=J0L_D-Sc2laJHL36nUAvIP3eN9BDryAxd_6aMQarlZc,1561
|
|
8
8
|
engeom/geom2/__init__.py,sha256=JFpiLyROUh6vyakG-7JDSlCMCn4QB2MQ8bz3uVCaAIk,373
|
9
9
|
engeom/geom2.pyi,sha256=508YJVNAJcZxEIZcWi4upcGtiZKoRnGtAW7TfTU3b3A,42922
|
10
10
|
engeom/geom3/__init__.py,sha256=l8B0iDhJ4YiRbslJLN791XWai2DWrpmZptnzIETMS9g,370
|
11
|
-
engeom/geom3.pyi,sha256=
|
11
|
+
engeom/geom3.pyi,sha256=EFVmO1VaR5EHQeGR0FZCR-XqXQA9_XUP9kky7o3kovI,57003
|
12
12
|
engeom/metrology/__init__.py,sha256=XvEhG8uDm1olWwZHDDrQv9LFP5zXhbsGx27PqRq8WE0,304
|
13
13
|
engeom/metrology.pyi,sha256=9I5un86VB_2gmQBrVYhX8JzILTUADMLB9Em8ttJxrWg,4044
|
14
|
-
engeom/plot.py,sha256=
|
14
|
+
engeom/plot.py,sha256=LTqqO-h1EJL6wanM0hB79s9ohWwaCIijMOHVplY3vmc,1079
|
15
15
|
engeom/raster3/__init__.py,sha256=iaayLrvco-ZMZPyeK47ox7rYne_51DNb2T2Q0iNNeKE,289
|
16
16
|
engeom/raster3.pyi,sha256=sBXXYXcDBiDU_OFDQiwa7Q3GcwSiUc4CLy6nJ1MwFqM,790
|
17
17
|
engeom/_plot/common.py,sha256=Py78ufN3yi59hPwv21SoGcqyZUJS-_PmK8tlAKgSG7Q,517
|
18
|
-
engeom/_plot/matplotlib.py,sha256=
|
19
|
-
engeom/_plot/pyvista.py,sha256
|
18
|
+
engeom/_plot/matplotlib.py,sha256=eqZsm-Lhq2svFSusW6_09T4UuxW9F0hBEbmMj6ZMywI,12934
|
19
|
+
engeom/_plot/pyvista.py,sha256=COVgiw4XlcbGjiLYE-eJjK_TJgONMGdW54pFsLczFm4,11879
|
20
20
|
engeom/_plot/__init__.py,sha256=F_KviZtxzZGwfEjjn8Ep46N4UVl8VpFJWBzbBUE_J7A,30
|
21
21
|
engeom/__init__.py,sha256=kYgFq3jq1quDfV013wEYQMlUBz4QNSpP6u8lFiuTHvc,115
|
22
|
-
engeom/engeom.pyd,sha256=
|
23
|
-
engeom-0.2.
|
22
|
+
engeom/engeom.pyd,sha256=D3LeWbFwwYzrdW54HjVUeYtyz_pmpypaWXTo3b-z2lQ,2446848
|
23
|
+
engeom-0.2.9.dist-info/RECORD,,
|
File without changes
|