engeom 0.2.13__cp38-abi3-win_amd64.whl → 0.2.15__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/pyvista.py +20 -2
- engeom/align.pyi +30 -1
- engeom/engeom.pyd +0 -0
- engeom/geom3.pyi +291 -0
- engeom/sensors/__init__.py +6 -0
- engeom/sensors.pyi +103 -0
- {engeom-0.2.13.dist-info → engeom-0.2.15.dist-info}/METADATA +1 -7
- {engeom-0.2.13.dist-info → engeom-0.2.15.dist-info}/RECORD +9 -9
- {engeom-0.2.13.dist-info → engeom-0.2.15.dist-info}/WHEEL +1 -1
- engeom/sensor/__init__.py +0 -6
- engeom/sensor.pyi +0 -58
engeom/_plot/pyvista.py
CHANGED
@@ -8,7 +8,7 @@ from typing import List, Any, Dict, Union, Iterable, Tuple
|
|
8
8
|
|
9
9
|
import numpy
|
10
10
|
|
11
|
-
from engeom.geom3 import Mesh, Curve3, Vector3, Point3, Iso3, SurfacePoint3
|
11
|
+
from engeom.geom3 import Mesh, Curve3, Vector3, Point3, Iso3, SurfacePoint3, PointCloud
|
12
12
|
from engeom.metrology import Distance3
|
13
13
|
from .common import LabelPlace
|
14
14
|
|
@@ -43,7 +43,7 @@ else:
|
|
43
43
|
def add_points(self, *points, color: pyvista.ColorLike = "b", point_size: float = 5.0,
|
44
44
|
render_points_as_spheres: bool = True, **kwargs) -> pyvista.vtkActor:
|
45
45
|
"""
|
46
|
-
Add one or more points to be plotted.
|
46
|
+
Add one or more discrete points to be plotted.
|
47
47
|
:param points: The points to add.
|
48
48
|
:param color: The color to use for the point(s).
|
49
49
|
:param point_size: The size of the point(s).
|
@@ -111,6 +111,24 @@ else:
|
|
111
111
|
data = pyvista.PolyData(mesh.vertices, faces)
|
112
112
|
return self.plotter.add_mesh(data, **kwargs)
|
113
113
|
|
114
|
+
def add_point_cloud(self, cloud: PointCloud, use_colors: bool = True, normal_arrow_size: float = 0.0, **kwargs):
|
115
|
+
actors = []
|
116
|
+
if normal_arrow_size >= 0.0 and cloud.normals is not None:
|
117
|
+
arrow_color = kwargs.get("color", "gray")
|
118
|
+
arrow_actor = self.plotter.add_arrows(cloud.points, cloud.normals, mag=normal_arrow_size,
|
119
|
+
color=arrow_color, reset_camera=False)
|
120
|
+
actors.append(arrow_actor)
|
121
|
+
|
122
|
+
if use_colors and cloud.colors is not None:
|
123
|
+
kwargs.pop("color", None) # Remove color if it's set, as colors will be used from the cloud
|
124
|
+
kwargs["scalars"] = cloud.colors
|
125
|
+
kwargs["rgba"] = True
|
126
|
+
|
127
|
+
point_actor = self.plotter.add_points(cloud.points, **kwargs)
|
128
|
+
actors.append(point_actor)
|
129
|
+
|
130
|
+
return actors
|
131
|
+
|
114
132
|
def distance(
|
115
133
|
self,
|
116
134
|
distance: Distance3,
|
engeom/align.pyi
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
from __future__ import annotations
|
2
2
|
import numpy
|
3
3
|
from .engeom import DeviationMode
|
4
|
-
from .geom3 import Mesh, Iso3
|
4
|
+
from .geom3 import Mesh, Iso3, PointCloud
|
5
5
|
|
6
6
|
|
7
7
|
def points_to_mesh(
|
@@ -21,4 +21,33 @@ def points_to_mesh(
|
|
21
21
|
and the mesh is calculated.
|
22
22
|
:return: the isometry that best aligns the points to the mesh.
|
23
23
|
"""
|
24
|
+
...
|
25
|
+
|
26
|
+
def points_to_cloud(
|
27
|
+
points: numpy.ndarray[float],
|
28
|
+
cloud: PointCloud,
|
29
|
+
search_radius: float,
|
30
|
+
initial: Iso3,
|
31
|
+
) -> Iso3:
|
32
|
+
...
|
33
|
+
|
34
|
+
def mesh_to_mesh_iterative(
|
35
|
+
mesh: Mesh,
|
36
|
+
reference: Mesh,
|
37
|
+
sample_spacing: float,
|
38
|
+
initial: Iso3,
|
39
|
+
mode: DeviationMode,
|
40
|
+
max_iter: int
|
41
|
+
) -> Iso3:
|
42
|
+
"""
|
43
|
+
Perform an iterative alignment of a mesh to a reference mesh using the specified parameters.
|
44
|
+
|
45
|
+
:param mesh: the mesh to align.
|
46
|
+
:param reference: the reference mesh to align to.
|
47
|
+
:param sample_spacing: the spacing between samples for the alignment.
|
48
|
+
:param initial: the initial guess for the isometry.
|
49
|
+
:param mode: the mode to use for the deviation calculation.
|
50
|
+
:param max_iter: the maximum number of iterations to perform.
|
51
|
+
:return: the isometry that best aligns the mesh to the reference mesh.
|
52
|
+
"""
|
24
53
|
...
|
engeom/engeom.pyd
CHANGED
Binary file
|
engeom/geom3.pyi
CHANGED
@@ -11,6 +11,50 @@ import metrology
|
|
11
11
|
Transformable3 = TypeVar("Transformable3", Vector3, Point3, Plane3, Iso3, SurfacePoint3)
|
12
12
|
PointOrVector3 = TypeVar("PointOrVector3", Vector3, Point3)
|
13
13
|
|
14
|
+
type Lptf3LoadEnum = Lptf3Load.All | Lptf3Load.TakeEveryN | Lptf3Load.SmoothSample
|
15
|
+
|
16
|
+
|
17
|
+
class Lptf3Load:
|
18
|
+
"""
|
19
|
+
An enumeration representing the different load types that can be used when loading LPTF3 files.
|
20
|
+
"""
|
21
|
+
|
22
|
+
class All:
|
23
|
+
def __init__(self):
|
24
|
+
"""
|
25
|
+
Load all points from the file
|
26
|
+
"""
|
27
|
+
...
|
28
|
+
|
29
|
+
class TakeEveryN:
|
30
|
+
def __init__(self, n: int):
|
31
|
+
"""
|
32
|
+
Load every nth row from the file. The loader will attempt to roughly match the inter-row spacing when
|
33
|
+
loading the individual points, resulting in an approximate grid-like array of points.
|
34
|
+
:param n: the interval at which to take rows from the file.
|
35
|
+
"""
|
36
|
+
...
|
37
|
+
|
38
|
+
class SmoothSample:
|
39
|
+
def __init__(self, take_every: int, look_scale: float, weight_scale: float, max_move: float):
|
40
|
+
"""
|
41
|
+
Load the points using a downsampling filter, which downsamples the point cloud similar to the `TakeEveryN`
|
42
|
+
method, but also performs a gaussian smoothing step using the full original cloud. This takes the longest
|
43
|
+
time, but can remove a significant amount of noise from the data by making use of an adjacency structure
|
44
|
+
that will be lost once the points are turned into a cloud.
|
45
|
+
|
46
|
+
:param take_every: the interval at which to take rows from the file.
|
47
|
+
:param look_scale: smoothing will use a sampling window relative to the `take_every` spacing, so a value
|
48
|
+
of 1 will use the same spacing as `take_every`, while a value of 2 will use twice that spacing. A reasonable
|
49
|
+
default for preserving detail is 0.5.
|
50
|
+
:param weight_scale: during the gaussian smoothing, neighboring points will be weighted by their distance
|
51
|
+
from the point being smoothed. At `weight_scale` of 1, the standard deviation of the gaussian will be
|
52
|
+
slightly larger than the `look_scale` distance.
|
53
|
+
:param max_move: the maximum distance a point can move when smoothing. If a point attempts to move more
|
54
|
+
than 10x this distance, it will not be moved at all. Otherwise, it will be clamped to within this distance.
|
55
|
+
"""
|
56
|
+
...
|
57
|
+
|
14
58
|
|
15
59
|
class Vector3(Iterable[float]):
|
16
60
|
"""
|
@@ -487,6 +531,13 @@ class Iso3:
|
|
487
531
|
""" Return the identity isometry. """
|
488
532
|
...
|
489
533
|
|
534
|
+
@staticmethod
|
535
|
+
def from_quaternion(tx: float, ty: float, tz: float, i: float, j: float, k: float, w: float) -> Iso3:
|
536
|
+
"""
|
537
|
+
Create an isometry from a translation and a quaternion representing the rotation.
|
538
|
+
:return: an isometry containing both translation and rotation components.
|
539
|
+
"""
|
540
|
+
|
490
541
|
@staticmethod
|
491
542
|
def from_translation(x: float, y: float, z: float) -> Iso3:
|
492
543
|
"""
|
@@ -956,6 +1007,36 @@ class Mesh:
|
|
956
1007
|
"""
|
957
1008
|
...
|
958
1009
|
|
1010
|
+
@staticmethod
|
1011
|
+
def load_lptf3(path: str | Path, params: Lptf3LoadEnum) -> Mesh:
|
1012
|
+
"""
|
1013
|
+
This function reads a LPTF3 file, which is a compact file format for storing 3D point data
|
1014
|
+
taken from a laser profile triangulation scanner. The format is simple and compact, capable
|
1015
|
+
of practically storing about 200k points (with an 8-bit color value each) per MB when using a
|
1016
|
+
16-bit coordinate format, or half that when using a 32-bit coordinate format.
|
1017
|
+
|
1018
|
+
There are a few different ways to load the data, controlled by the `Lptf3Load` enum:
|
1019
|
+
- `Lptf3Load.All`: Load all points from the file.
|
1020
|
+
- `Lptf3Load.TakeEveryN(n)`: Load every Nth row from the file. The loader will attempt to
|
1021
|
+
roughly match the x spacing of the points to the gap distance between rows, resulting in a
|
1022
|
+
grid-like point cloud with an approximately uniform point spacing when viewed from the
|
1023
|
+
X-Y plane. This is a very fast method of retrieving a downsampled set of points.
|
1024
|
+
- `Lptf3Load.SmoothSample(params)`: Load the points using a downsampling filter, which
|
1025
|
+
downsamples the point cloud similar to the `TakeEveryN` method, but also performs a gaussian
|
1026
|
+
smoothing step using the full original cloud. This takes the longest time, but can remove
|
1027
|
+
a significant amount of noise from the data by making use of an adjacency structure that
|
1028
|
+
will be lost once the points are turned into a mesh.
|
1029
|
+
|
1030
|
+
Once the points are loaded, they will be converted into a triangle mesh by connecting points in adjacent
|
1031
|
+
rows with triangles that meet certain edge length criterial. The result is a fast mesh that can be built
|
1032
|
+
using knowledge of the LPTF3's internal structure rather than having to rely on more general techniques
|
1033
|
+
that can build meshes from arbitrary point clouds.
|
1034
|
+
|
1035
|
+
:param path: the path to the LPTF3 file to load.
|
1036
|
+
:param params: the method and parameters to use when loading the LPTF3 file.
|
1037
|
+
"""
|
1038
|
+
...
|
1039
|
+
|
959
1040
|
def write_stl(self, path: str | Path):
|
960
1041
|
"""
|
961
1042
|
Write the mesh to an STL file. This will write the vertices and triangles of the mesh to the file in binary
|
@@ -1082,6 +1163,35 @@ class Mesh:
|
|
1082
1163
|
"""
|
1083
1164
|
...
|
1084
1165
|
|
1166
|
+
def sample_alignment_points(
|
1167
|
+
self,
|
1168
|
+
reference: Mesh,
|
1169
|
+
iso: Iso3,
|
1170
|
+
max_spacing: float,
|
1171
|
+
max_neighbor_angle: float,
|
1172
|
+
out_of_plane_ratio: float,
|
1173
|
+
centroid_ratio: float,
|
1174
|
+
filter_distances: float | None
|
1175
|
+
) -> NDArray[float]:
|
1176
|
+
"""
|
1177
|
+
This is a very specialized, highly selective sampling method used to identify high quality points for
|
1178
|
+
the alignment between two meshes. It begins with a Poisson disk sampling of the mesh, and then inspects the
|
1179
|
+
individual points to evaluate the quality and consistency of their local neighborhood, before projecting their
|
1180
|
+
local neighborhood onto the reference mesh and looking for the same qualities in the projections.
|
1181
|
+
|
1182
|
+
This method will return a numpy array of points which are spaced at least `max_spacing` apart, and which lie
|
1183
|
+
on areas of the mesh of low curvature, away from corners and edges, and which plausibly overlap with a
|
1184
|
+
correspondingly low-curvature area of the reference mesh away from its corners and edges.
|
1185
|
+
|
1186
|
+
:param max_spacing: a Poisson disk sampling radius used to start sampling the mesh. This value is also used to
|
1187
|
+
derive a set of physical limits which will selectively filter different aspects of the sample points.
|
1188
|
+
:param reference: the reference mesh that the alignment candidates will be sampled against. Assuming these
|
1189
|
+
points will be used to perform an alignment, this mesh should be the one that is being aligned to.
|
1190
|
+
:param iso: an isometry to apply to the sampled points before checking against the reference mesh.
|
1191
|
+
:return: a numpy array of shape (n, 3) containing the sampled points.
|
1192
|
+
"""
|
1193
|
+
...
|
1194
|
+
|
1085
1195
|
def section(self, plane: Plane3, tol: float | None = None) -> List[Curve3]:
|
1086
1196
|
"""
|
1087
1197
|
Calculate and return the intersection curves between the mesh and a plane.
|
@@ -1207,6 +1317,15 @@ class Mesh:
|
|
1207
1317
|
:return: a `SurfacePoint3` object containing the closest point and normal
|
1208
1318
|
"""
|
1209
1319
|
...
|
1320
|
+
def point_closest_to(self, x: float, y: float, z: float) -> Point3:
|
1321
|
+
"""
|
1322
|
+
Find the closest point on the surface of the mesh to a given point in space, returning the point
|
1323
|
+
:param x: the x coordinate of the point to find the closest point to
|
1324
|
+
:param y: the y coordinate of the point to find the closest point to
|
1325
|
+
:param z: the z coordinate of the point to find the closest point to
|
1326
|
+
:return: a `Point3` object containing the closest point and normal
|
1327
|
+
"""
|
1328
|
+
...
|
1210
1329
|
|
1211
1330
|
def visual_outline(
|
1212
1331
|
self,
|
@@ -1241,6 +1360,16 @@ class Mesh:
|
|
1241
1360
|
"""
|
1242
1361
|
...
|
1243
1362
|
|
1363
|
+
def boundary_curves(self) -> List[Curve3]:
|
1364
|
+
"""
|
1365
|
+
Extract the boundary curves of the mesh. This will return a list of `Curve3` objects representing the
|
1366
|
+
boundaries of the mesh. The curves will be ordered in a way that they can be used to reconstruct the boundary
|
1367
|
+
of the mesh.
|
1368
|
+
|
1369
|
+
:return: a list of `Curve3` objects representing the boundary curves of the mesh.
|
1370
|
+
"""
|
1371
|
+
...
|
1372
|
+
|
1244
1373
|
@staticmethod
|
1245
1374
|
def create_box(length: float, width: float, height: float) -> Mesh:
|
1246
1375
|
"""
|
@@ -1796,3 +1925,165 @@ class RayBundle3:
|
|
1796
1925
|
:return:
|
1797
1926
|
"""
|
1798
1927
|
...
|
1928
|
+
|
1929
|
+
|
1930
|
+
class PointCloud:
|
1931
|
+
"""
|
1932
|
+
|
1933
|
+
"""
|
1934
|
+
|
1935
|
+
def __init__(self, points: NDArray[float], normals: NDArray[float] | None = None,
|
1936
|
+
colors: NDArray[numpy.uint8] | None = None):
|
1937
|
+
...
|
1938
|
+
|
1939
|
+
@property
|
1940
|
+
def points(self) -> NDArray[float]:
|
1941
|
+
"""
|
1942
|
+
Get the points of the point cloud as a numpy array of shape (n, 3).
|
1943
|
+
:return: a numpy array of shape (n, 3) containing the points of the point cloud.
|
1944
|
+
"""
|
1945
|
+
...
|
1946
|
+
|
1947
|
+
@property
|
1948
|
+
def normals(self) -> NDArray[float] | None:
|
1949
|
+
"""
|
1950
|
+
Get the normals of the point cloud as a numpy array of shape (n, 3). If no normals were provided, this will
|
1951
|
+
return None.
|
1952
|
+
:return: a numpy array of shape (n, 3) containing the normals of the point cloud, or None if no normals were
|
1953
|
+
provided.
|
1954
|
+
"""
|
1955
|
+
...
|
1956
|
+
|
1957
|
+
@property
|
1958
|
+
def colors(self) -> NDArray[numpy.uint8] | None:
|
1959
|
+
"""
|
1960
|
+
Get the colors of the point cloud as a numpy array of shape (n, 3). If no colors were provided, this will
|
1961
|
+
return None.
|
1962
|
+
:return: a numpy array of shape (n, 3) containing the colors of the point cloud, or None if no colors were
|
1963
|
+
provided.
|
1964
|
+
"""
|
1965
|
+
...
|
1966
|
+
|
1967
|
+
def cloned(self) -> PointCloud:
|
1968
|
+
"""
|
1969
|
+
Create a copy of the point cloud. This will return a new `PointCloud` object with the same points, normals, and
|
1970
|
+
colors as the original.
|
1971
|
+
|
1972
|
+
:return: a new `PointCloud` object with the same points, normals, and colors as the original.
|
1973
|
+
"""
|
1974
|
+
...
|
1975
|
+
|
1976
|
+
@staticmethod
|
1977
|
+
def load_lptf3(path: str | Path, params: Lptf3LoadEnum) -> PointCloud:
|
1978
|
+
"""
|
1979
|
+
This function reads a LPTF3 file, which is a compact file format for storing 3D point data
|
1980
|
+
taken from a laser profile triangulation scanner. The format is simple and compact, capable
|
1981
|
+
of practically storing about 200k points (with an 8-bit color value each) per MB when using a
|
1982
|
+
16-bit coordinate format, or half that when using a 32-bit coordinate format.
|
1983
|
+
|
1984
|
+
There are a few different ways to load the data, controlled by the `Lptf3Load` enum:
|
1985
|
+
- `Lptf3Load.All`: Load all points from the file.
|
1986
|
+
- `Lptf3Load.TakeEveryN(n)`: Load every Nth row from the file. The loader will attempt to
|
1987
|
+
roughly match the x spacing of the points to the gap distance between rows, resulting in a
|
1988
|
+
grid-like point cloud with an approximately uniform point spacing when viewed from the
|
1989
|
+
X-Y plane. This is a very fast method of retrieving a downsampled point cloud.
|
1990
|
+
- `Lptf3Load.SmoothSample(params)`: Load the points using a downsampling filter, which
|
1991
|
+
downsamples the point cloud similar to the `TakeEveryN` method, but also performs a gaussian
|
1992
|
+
smoothing step using the full original cloud. This takes the longest time, but can remove
|
1993
|
+
a significant amount of noise from the data by making use of an adjacency structure that
|
1994
|
+
will be lost once the points are turned into a cloud.
|
1995
|
+
|
1996
|
+
:param path: the path to the LPTF3 file to load.
|
1997
|
+
:param params: the method and parameters to use when loading the LPTF3 file.
|
1998
|
+
"""
|
1999
|
+
...
|
2000
|
+
|
2001
|
+
def append(self, other: PointCloud) -> PointCloud:
|
2002
|
+
"""
|
2003
|
+
Append another point cloud to this one. The points, normals, and colors from the other point cloud will be
|
2004
|
+
added to this point cloud.
|
2005
|
+
|
2006
|
+
Will throw an error if the other point cloud has a different combination of normals and colors than this one.
|
2007
|
+
|
2008
|
+
:param other: the other point cloud to append.
|
2009
|
+
:return: a new `PointCloud` object containing the combined points, normals, and colors.
|
2010
|
+
"""
|
2011
|
+
...
|
2012
|
+
|
2013
|
+
def sample_poisson_disk(self, radius: float) -> list[int]:
|
2014
|
+
"""
|
2015
|
+
Sample a subset of points from the point cloud using a Poisson disk sampling algorithm. This will return a list
|
2016
|
+
of indices of the points that were preserved. The points will be selected such that no two points are closer
|
2017
|
+
than the given radius.
|
2018
|
+
|
2019
|
+
:param radius: the minimum distance between sampled points.
|
2020
|
+
:return: a list of indices of the points that were selected.
|
2021
|
+
"""
|
2022
|
+
...
|
2023
|
+
|
2024
|
+
def create_from_indices(self, indices: list[int]) -> PointCloud:
|
2025
|
+
"""
|
2026
|
+
Create a new point cloud from a subset of the points in this point cloud, specified by the given indices.
|
2027
|
+
The normals and colors will also be subsetted to match the points.
|
2028
|
+
|
2029
|
+
:param indices: a list of indices to select from the point cloud.
|
2030
|
+
:return: a new `PointCloud` object containing the selected points, normals, and colors.
|
2031
|
+
"""
|
2032
|
+
...
|
2033
|
+
|
2034
|
+
def create_from_poisson_sample(self, radius: float) -> PointCloud:
|
2035
|
+
"""
|
2036
|
+
Create a new point cloud from a Poisson disk sampling of the points in this point cloud. The points will be
|
2037
|
+
selected such that no two points are closer than the given radius.
|
2038
|
+
|
2039
|
+
:param radius: the minimum distance between sampled points.
|
2040
|
+
:return: a new `PointCloud` object containing the sampled points, normals, and colors.
|
2041
|
+
"""
|
2042
|
+
...
|
2043
|
+
|
2044
|
+
def transform_by(self, iso: Iso3) -> PointCloud:
|
2045
|
+
"""
|
2046
|
+
Transform the point cloud by an isometry. This will return a new `PointCloud` object with the transformed
|
2047
|
+
points, normals, and colors.
|
2048
|
+
|
2049
|
+
:param iso: the isometry to transform the point cloud by.
|
2050
|
+
:return: a new `PointCloud` object with the transformed points, normals, and colors.
|
2051
|
+
"""
|
2052
|
+
...
|
2053
|
+
|
2054
|
+
def overlap_points_by_reciprocity(self, other: PointCloud, max_distance: float) -> list[int]:
|
2055
|
+
"""
|
2056
|
+
Find the indices of points in this point cloud that "overlap" with points in another point
|
2057
|
+
cloud by looking for reciprocity in the closest point in each direction.
|
2058
|
+
|
2059
|
+
For each point in this point cloud "p_this", we will find the closest point in the other
|
2060
|
+
point cloud "p_other". Then we take "p_other" and find the closest point to it in this
|
2061
|
+
point cloud, "p_recip".
|
2062
|
+
|
2063
|
+
In an ideally overlapping point cloud, "p_recip" should be the same as "p_this". We will
|
2064
|
+
use a maximum distance tolerance to determine if "p_recip" is close enough to "p_this" that
|
2065
|
+
"p_this" is considered to be overlapping with the other point cloud.
|
2066
|
+
|
2067
|
+
:param other: the other point cloud to check for overlap.
|
2068
|
+
:param max_distance: the maximum distance to consider a point as overlapping.
|
2069
|
+
:return: a list of indices of points in this point cloud that overlap with points in the other point cloud.
|
2070
|
+
"""
|
2071
|
+
...
|
2072
|
+
|
2073
|
+
def overlap_mesh_by_reciprocity(self, mesh: Mesh, max_distance: float) -> list[int]:
|
2074
|
+
"""
|
2075
|
+
Find the indices of points in this point cloud that "overlap" with triangles in a mesh by looking for
|
2076
|
+
reciprocity in the closest point in each direction.
|
2077
|
+
|
2078
|
+
For each point in this point cloud "p_this", we will find the closest point on the surface of the mesh
|
2079
|
+
"p_other". Then we will take "p_other" and find the closest point in the point cloud, "p_recip".
|
2080
|
+
|
2081
|
+
In an ideally overlapping point cloud, "p_this" should be the same as "p_recip". We will use a maximum
|
2082
|
+
distance tolerance instead to determine if "p_recip" is close enough to "p_this" that "p_this" is
|
2083
|
+
considered to be overlapping with the mesh.
|
2084
|
+
|
2085
|
+
:param mesh: the mesh to check for overlap.
|
2086
|
+
:param max_distance: the maximum distance to consider a point as overlapping.
|
2087
|
+
:return: a list of indices of points in this point cloud that overlap with triangles in the mesh.
|
2088
|
+
"""
|
2089
|
+
...
|
engeom/sensors.pyi
ADDED
@@ -0,0 +1,103 @@
|
|
1
|
+
from __future__ import annotations
|
2
|
+
|
3
|
+
from pathlib import Path
|
4
|
+
|
5
|
+
from .geom3 import Point3, Mesh, Iso3, Vector3, PointCloud
|
6
|
+
|
7
|
+
|
8
|
+
class LaserProfile:
|
9
|
+
def __init__(
|
10
|
+
self,
|
11
|
+
emitter_z: float,
|
12
|
+
detector_y: float,
|
13
|
+
detector_z: float,
|
14
|
+
volume_width: float,
|
15
|
+
volume_z_min: float,
|
16
|
+
volume_z_max: float,
|
17
|
+
resolution: int,
|
18
|
+
angle_limit: float | None = None,
|
19
|
+
):
|
20
|
+
"""
|
21
|
+
Create the base geometry of a laser profile line sensor, which emits a laser line into a
|
22
|
+
scene and detects the reflection of that line to triangulate the distance to points on a
|
23
|
+
surface.
|
24
|
+
|
25
|
+
The general coordinate system is specified in X and Z. The center of the detection volume
|
26
|
+
is at the origin, with the laser line ranging from the -X direction to the +X direction.
|
27
|
+
The +Z direction points directly up towards the emitter. The +Y direction is orthogonal to
|
28
|
+
laser line and is typically the direction which the sensor will be panned.
|
29
|
+
|
30
|
+
The geometry is specified with the following assumptions:
|
31
|
+
- The laser line is emitted from a point directly on the +Z axis, with no offset in
|
32
|
+
the X or Y direction.
|
33
|
+
- The detector is not offset in the X direction, and can be specified with a Y and
|
34
|
+
Z offset from the center of the detection volume.
|
35
|
+
- The detection volume is trapezoidal, and its flat top and bottom are specified by a
|
36
|
+
maximum and minimum Z value.
|
37
|
+
- The detection volume's with is specified at Z=0, and is symmetrical around X=0.
|
38
|
+
|
39
|
+
# Arguments
|
40
|
+
|
41
|
+
:param emitter_z: The Z coordinate of the laser emitter. This is the height from the volume
|
42
|
+
center where the laser fans into a triangle.
|
43
|
+
:param detector_y: The Y coordinate of the detector's optical center. This is the out-of-plane
|
44
|
+
offset from the plane of the laser line.
|
45
|
+
:param detector_z: The Z coordinate of the detector's optical center. This is the height from
|
46
|
+
the volume center where the detector's optical center is located.
|
47
|
+
:param volume_width: The width of the detection volume at Z=0. The volume is assumed to be
|
48
|
+
symmetrical around the X axis, ranging from -volume_width/2 to +volume_width/2.
|
49
|
+
:param volume_z_min: The minimum Z value of the detection volume. This is the bottom of the
|
50
|
+
trapezoidal volume, the farthest distance from the emitter where the sensor will still
|
51
|
+
return points.
|
52
|
+
:param volume_z_max: The maximum Z value of the detection volume. This is the top of the
|
53
|
+
trapezoidal volume, the closest distance to the emitter where the sensor will still
|
54
|
+
return points.
|
55
|
+
:param resolution: The number of rays to cast across the laser line. This is the number of
|
56
|
+
points that will be returned in the point cloud.
|
57
|
+
:param angle_limit: An optional angle limit in radians. If specified, the sensor will only
|
58
|
+
return a point if the angle between the surface normal at the point and the detector is
|
59
|
+
less than this limit.
|
60
|
+
"""
|
61
|
+
...
|
62
|
+
|
63
|
+
def get_points(self, target: Mesh, obstruction: Mesh | None, iso: Iso3) -> PointCloud:
|
64
|
+
"""
|
65
|
+
|
66
|
+
:param target:
|
67
|
+
:param obstruction:
|
68
|
+
:param iso:
|
69
|
+
:return:
|
70
|
+
"""
|
71
|
+
...
|
72
|
+
|
73
|
+
def load_lptf3(self, path: str | Path, take_every: int | None = None,
|
74
|
+
normal_neighborhood: float | None = None) -> PointCloud:
|
75
|
+
"""
|
76
|
+
Load a laser profile from a LPTF3 file.
|
77
|
+
|
78
|
+
:param path: The path to the LPTF3 file.
|
79
|
+
:param take_every: Optional parameter to take every nth row/col from the file.
|
80
|
+
:param normal_neighborhood: Optional parameter to specify the neighborhood size for normal
|
81
|
+
calculation.
|
82
|
+
:return: A PointCloud containing the points from the LPTF3 file.
|
83
|
+
"""
|
84
|
+
...
|
85
|
+
|
86
|
+
|
87
|
+
class PanningLaserProfile:
|
88
|
+
def __init__(self, laser_line: LaserProfile, y_step: float, steps: int):
|
89
|
+
"""
|
90
|
+
:param laser_line:
|
91
|
+
:param y_step:
|
92
|
+
:param steps:
|
93
|
+
"""
|
94
|
+
...
|
95
|
+
|
96
|
+
def get_points(self, target: Mesh, obstruction: Mesh | None, iso: Iso3) -> PointCloud:
|
97
|
+
"""
|
98
|
+
:param target:
|
99
|
+
:param obstruction:
|
100
|
+
:param iso:
|
101
|
+
:return:
|
102
|
+
"""
|
103
|
+
...
|
@@ -1,6 +1,6 @@
|
|
1
1
|
Metadata-Version: 2.4
|
2
2
|
Name: engeom
|
3
|
-
Version: 0.2.
|
3
|
+
Version: 0.2.15
|
4
4
|
Classifier: Programming Language :: Rust
|
5
5
|
Classifier: Programming Language :: Python :: Implementation :: CPython
|
6
6
|
Classifier: Programming Language :: Python :: Implementation :: PyPy
|
@@ -8,9 +8,3 @@ 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
|
-
|
@@ -1,25 +1,25 @@
|
|
1
|
-
engeom-0.2.
|
2
|
-
engeom-0.2.
|
1
|
+
engeom-0.2.15.dist-info/METADATA,sha256=WoxcP2de4LzW9Sr6URHa3m7fL68MYDvBonV6MtEKYm4,340
|
2
|
+
engeom-0.2.15.dist-info/WHEEL,sha256=lvaVdaNOIbpDjZxhxQcXMmDSpIrmQUI6MiaH-nloUu8,94
|
3
3
|
engeom/__init__.py,sha256=kYgFq3jq1quDfV013wEYQMlUBz4QNSpP6u8lFiuTHvc,115
|
4
4
|
engeom/_plot/__init__.py,sha256=F_KviZtxzZGwfEjjn8Ep46N4UVl8VpFJWBzbBUE_J7A,30
|
5
5
|
engeom/_plot/common.py,sha256=Py78ufN3yi59hPwv21SoGcqyZUJS-_PmK8tlAKgSG7Q,517
|
6
6
|
engeom/_plot/matplotlib.py,sha256=ahLfgE3QHUFcNig6cHkFu9mwSwfMbDcNqkZmGaBh4Zk,15267
|
7
|
-
engeom/_plot/pyvista.py,sha256=
|
7
|
+
engeom/_plot/pyvista.py,sha256=lzwDWUFTbq1cR46nwVtuK4nn_hzbZnXiJPdoxHcKVDU,13930
|
8
8
|
engeom/airfoil.pyi,sha256=SivSrUo3LZSVgXwIFJtgUUejhPh71y8rekzBwaX6exI,24165
|
9
9
|
engeom/airfoil/__init__.py,sha256=gpS9pVepUu90XJ-ePndNupbUMKI0RGxNXPxD9x0iVHY,274
|
10
|
-
engeom/align.pyi,sha256=
|
10
|
+
engeom/align.pyi,sha256=SaC46l0mqANzp3JAtIk4DdXTLtKBrEr9_xW21algMTk,1935
|
11
11
|
engeom/align/__init__.py,sha256=SEeMqeqLKqJC73Mg8GwPwd9NwWnl-dcCqJ4rPdh8yyc,196
|
12
|
-
engeom/engeom.pyd,sha256=
|
12
|
+
engeom/engeom.pyd,sha256=L1mSrY9HAdXdyoru5rJDG4yaAAuTnLgrGE-Y6URJW80,6136320
|
13
13
|
engeom/engeom.pyi,sha256=J0L_D-Sc2laJHL36nUAvIP3eN9BDryAxd_6aMQarlZc,1561
|
14
14
|
engeom/geom2.pyi,sha256=oUSner8BEJzJLv82POfOGyjAESw-McZzPq51o9VbdYg,51601
|
15
15
|
engeom/geom2/__init__.py,sha256=JFpiLyROUh6vyakG-7JDSlCMCn4QB2MQ8bz3uVCaAIk,373
|
16
|
-
engeom/geom3.pyi,sha256=
|
16
|
+
engeom/geom3.pyi,sha256=S6PIfcGDxc4kMZDn6uJO_L-DBepzMnUM8RzjiDkQcOU,92982
|
17
17
|
engeom/geom3/__init__.py,sha256=l8B0iDhJ4YiRbslJLN791XWai2DWrpmZptnzIETMS9g,370
|
18
18
|
engeom/metrology.pyi,sha256=9I5un86VB_2gmQBrVYhX8JzILTUADMLB9Em8ttJxrWg,4044
|
19
19
|
engeom/metrology/__init__.py,sha256=XvEhG8uDm1olWwZHDDrQv9LFP5zXhbsGx27PqRq8WE0,304
|
20
20
|
engeom/plot.py,sha256=LTqqO-h1EJL6wanM0hB79s9ohWwaCIijMOHVplY3vmc,1079
|
21
21
|
engeom/raster3.pyi,sha256=sBXXYXcDBiDU_OFDQiwa7Q3GcwSiUc4CLy6nJ1MwFqM,790
|
22
22
|
engeom/raster3/__init__.py,sha256=iaayLrvco-ZMZPyeK47ox7rYne_51DNb2T2Q0iNNeKE,289
|
23
|
-
engeom/
|
24
|
-
engeom/
|
25
|
-
engeom-0.2.
|
23
|
+
engeom/sensors.pyi,sha256=8dQS6PVkbBOdbO17x9UskBOIIh6cP0EILhJXxPVXDNw,4525
|
24
|
+
engeom/sensors/__init__.py,sha256=vy1CXX3gQcaBL25imYmpSAJhlc8v5aDBEBtF6L0PVCs,182
|
25
|
+
engeom-0.2.15.dist-info/RECORD,,
|
engeom/sensor/__init__.py
DELETED
engeom/sensor.pyi
DELETED
@@ -1,58 +0,0 @@
|
|
1
|
-
from __future__ import annotations
|
2
|
-
from .geom3 import Point3, Mesh, Iso3, Vector3
|
3
|
-
from numpy.typing import NDArray
|
4
|
-
|
5
|
-
|
6
|
-
class LaserLine:
|
7
|
-
def __init__(
|
8
|
-
self,
|
9
|
-
ray_origin: Point3,
|
10
|
-
detect_origin: Point3,
|
11
|
-
line_start: Point3,
|
12
|
-
line_end: Point3,
|
13
|
-
min_range: float,
|
14
|
-
max_range: float,
|
15
|
-
rays: int,
|
16
|
-
angle_limit: float | None = None,
|
17
|
-
):
|
18
|
-
"""
|
19
|
-
|
20
|
-
:param ray_origin:
|
21
|
-
:param detect_origin:
|
22
|
-
:param line_start:
|
23
|
-
:param line_end:
|
24
|
-
:param min_range:
|
25
|
-
:param max_range:
|
26
|
-
:param rays:
|
27
|
-
:param angle_limit:
|
28
|
-
"""
|
29
|
-
...
|
30
|
-
|
31
|
-
def get_points(self, target: Mesh, obstruction: Mesh | None, iso: Iso3) -> NDArray[float]:
|
32
|
-
"""
|
33
|
-
|
34
|
-
:param target:
|
35
|
-
:param obstruction:
|
36
|
-
:param iso:
|
37
|
-
:return:
|
38
|
-
"""
|
39
|
-
...
|
40
|
-
|
41
|
-
|
42
|
-
class PanningLaserLine:
|
43
|
-
def __init__(self, laser_line: LaserLine, pan_vector: Vector3, steps: int):
|
44
|
-
"""
|
45
|
-
:param laser_line:
|
46
|
-
:param pan_vector:
|
47
|
-
:param steps:
|
48
|
-
"""
|
49
|
-
...
|
50
|
-
|
51
|
-
def get_points(self, target: Mesh, obstruction: Mesh | None, iso: Iso3) -> NDArray[float]:
|
52
|
-
"""
|
53
|
-
:param target:
|
54
|
-
:param obstruction:
|
55
|
-
:param iso:
|
56
|
-
:return:
|
57
|
-
"""
|
58
|
-
...
|