open-space-toolkit-mathematics 4.6.0__py39-none-manylinux2014_aarch64.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.
- open_space_toolkit_mathematics-4.6.0.dist-info/METADATA +28 -0
- open_space_toolkit_mathematics-4.6.0.dist-info/RECORD +68 -0
- open_space_toolkit_mathematics-4.6.0.dist-info/WHEEL +5 -0
- open_space_toolkit_mathematics-4.6.0.dist-info/top_level.txt +1 -0
- open_space_toolkit_mathematics-4.6.0.dist-info/zip-safe +1 -0
- ostk/__init__.py +1 -0
- ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-39-aarch64-linux-gnu.so +0 -0
- ostk/mathematics/__init__.py +5 -0
- ostk/mathematics/__init__.pyi +11 -0
- ostk/mathematics/curve_fitting/__init__.pyi +155 -0
- ostk/mathematics/curve_fitting/interpolator.pyi +243 -0
- ostk/mathematics/geometry/__init__.pyi +504 -0
- ostk/mathematics/geometry/d2/__init__.pyi +809 -0
- ostk/mathematics/geometry/d2/object.pyi +1779 -0
- ostk/mathematics/geometry/d3/__init__.pyi +1032 -0
- ostk/mathematics/geometry/d3/object.pyi +3709 -0
- ostk/mathematics/geometry/d3/transformation/__init__.pyi +3 -0
- ostk/mathematics/geometry/d3/transformation/rotation.pyi +1358 -0
- ostk/mathematics/libopen-space-toolkit-mathematics.so.4 +0 -0
- ostk/mathematics/object.pyi +387 -0
- ostk/mathematics/solver.pyi +342 -0
- ostk/mathematics/test/__init__.py +1 -0
- ostk/mathematics/test/curve_fitting/__init__.py +1 -0
- ostk/mathematics/test/curve_fitting/interpolator/__init__.py +1 -0
- ostk/mathematics/test/curve_fitting/interpolator/test_barycentric_rational.py +44 -0
- ostk/mathematics/test/curve_fitting/interpolator/test_cubic_spline.py +55 -0
- ostk/mathematics/test/curve_fitting/interpolator/test_interpolator.py +71 -0
- ostk/mathematics/test/curve_fitting/interpolator/test_linear.py +45 -0
- ostk/mathematics/test/geometry/__init__.py +1 -0
- ostk/mathematics/test/geometry/d2/__init__.py +1 -0
- ostk/mathematics/test/geometry/d2/conftest.py +79 -0
- ostk/mathematics/test/geometry/d2/object/__init__.py +1 -0
- ostk/mathematics/test/geometry/d2/object/test_composite.py +93 -0
- ostk/mathematics/test/geometry/d2/object/test_line.py +57 -0
- ostk/mathematics/test/geometry/d2/object/test_linestring.py +174 -0
- ostk/mathematics/test/geometry/d2/object/test_multipolygon.py +94 -0
- ostk/mathematics/test/geometry/d2/object/test_point.py +213 -0
- ostk/mathematics/test/geometry/d2/object/test_point_set.py +100 -0
- ostk/mathematics/test/geometry/d2/object/test_polygon.py +370 -0
- ostk/mathematics/test/geometry/d2/object/test_segment.py +104 -0
- ostk/mathematics/test/geometry/d2/test_object.py +25 -0
- ostk/mathematics/test/geometry/d2/test_transformation.py +84 -0
- ostk/mathematics/test/geometry/d3/__init__.py +1 -0
- ostk/mathematics/test/geometry/d3/object/__init__.py +1 -0
- ostk/mathematics/test/geometry/d3/object/test_composite.py +262 -0
- ostk/mathematics/test/geometry/d3/object/test_cuboid.py +20 -0
- ostk/mathematics/test/geometry/d3/object/test_line.py +68 -0
- ostk/mathematics/test/geometry/d3/object/test_linestring.py +168 -0
- ostk/mathematics/test/geometry/d3/object/test_point.py +234 -0
- ostk/mathematics/test/geometry/d3/object/test_point_set.py +113 -0
- ostk/mathematics/test/geometry/d3/object/test_polygon.py +141 -0
- ostk/mathematics/test/geometry/d3/object/test_segment.py +120 -0
- ostk/mathematics/test/geometry/d3/objects/test_cuboid.py +20 -0
- ostk/mathematics/test/geometry/d3/test_intersection.py +3 -0
- ostk/mathematics/test/geometry/d3/test_object.py +3 -0
- ostk/mathematics/test/geometry/d3/test_transformation.py +3 -0
- ostk/mathematics/test/geometry/d3/transformation/__init__.py +1 -0
- ostk/mathematics/test/geometry/d3/transformation/rotation/__init__.py +1 -0
- ostk/mathematics/test/geometry/d3/transformation/rotation/test_euler_angle.py +138 -0
- ostk/mathematics/test/geometry/d3/transformation/rotation/test_quaternion.py +189 -0
- ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_matrix.py +40 -0
- ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_vector.py +47 -0
- ostk/mathematics/test/geometry/test_angle.py +345 -0
- ostk/mathematics/test/object/__init__.py +1 -0
- ostk/mathematics/test/object/test_interval.py +515 -0
- ostk/mathematics/test/object/test_vector.py +5 -0
- ostk/mathematics/test/solver/test_numerical_solver.py +176 -0
- ostk/mathematics/test/test_object.py +24 -0
|
@@ -0,0 +1,1032 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import numpy
|
|
3
|
+
import ostk.core.type
|
|
4
|
+
import typing
|
|
5
|
+
from . import object
|
|
6
|
+
from . import transformation
|
|
7
|
+
__all__ = ['Intersection', 'Object', 'Transformation', 'object', 'transformation']
|
|
8
|
+
class Intersection:
|
|
9
|
+
"""
|
|
10
|
+
|
|
11
|
+
Represents the intersection of 3D geometric objects.
|
|
12
|
+
|
|
13
|
+
An Intersection can contain various geometric types resulting from intersecting two objects.
|
|
14
|
+
|
|
15
|
+
"""
|
|
16
|
+
class Type:
|
|
17
|
+
"""
|
|
18
|
+
Members:
|
|
19
|
+
|
|
20
|
+
Undefined
|
|
21
|
+
|
|
22
|
+
Empty
|
|
23
|
+
|
|
24
|
+
Point
|
|
25
|
+
|
|
26
|
+
PointSet
|
|
27
|
+
|
|
28
|
+
Line
|
|
29
|
+
|
|
30
|
+
Ray
|
|
31
|
+
|
|
32
|
+
Segment
|
|
33
|
+
|
|
34
|
+
Plane
|
|
35
|
+
|
|
36
|
+
Sphere
|
|
37
|
+
|
|
38
|
+
Ellipsoid
|
|
39
|
+
|
|
40
|
+
Complex
|
|
41
|
+
"""
|
|
42
|
+
Complex: typing.ClassVar[Intersection.Type] # value = <Type.Complex: 14>
|
|
43
|
+
Ellipsoid: typing.ClassVar[Intersection.Type] # value = <Type.Ellipsoid: 12>
|
|
44
|
+
Empty: typing.ClassVar[Intersection.Type] # value = <Type.Empty: 1>
|
|
45
|
+
Line: typing.ClassVar[Intersection.Type] # value = <Type.Line: 4>
|
|
46
|
+
Plane: typing.ClassVar[Intersection.Type] # value = <Type.Plane: 9>
|
|
47
|
+
Point: typing.ClassVar[Intersection.Type] # value = <Type.Point: 2>
|
|
48
|
+
PointSet: typing.ClassVar[Intersection.Type] # value = <Type.PointSet: 3>
|
|
49
|
+
Ray: typing.ClassVar[Intersection.Type] # value = <Type.Ray: 5>
|
|
50
|
+
Segment: typing.ClassVar[Intersection.Type] # value = <Type.Segment: 6>
|
|
51
|
+
Sphere: typing.ClassVar[Intersection.Type] # value = <Type.Sphere: 11>
|
|
52
|
+
Undefined: typing.ClassVar[Intersection.Type] # value = <Type.Undefined: 0>
|
|
53
|
+
__members__: typing.ClassVar[dict[str, Intersection.Type]] # value = {'Undefined': <Type.Undefined: 0>, 'Empty': <Type.Empty: 1>, 'Point': <Type.Point: 2>, 'PointSet': <Type.PointSet: 3>, 'Line': <Type.Line: 4>, 'Ray': <Type.Ray: 5>, 'Segment': <Type.Segment: 6>, 'Plane': <Type.Plane: 9>, 'Sphere': <Type.Sphere: 11>, 'Ellipsoid': <Type.Ellipsoid: 12>, 'Complex': <Type.Complex: 14>}
|
|
54
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
55
|
+
...
|
|
56
|
+
def __getstate__(self) -> int:
|
|
57
|
+
...
|
|
58
|
+
def __hash__(self) -> int:
|
|
59
|
+
...
|
|
60
|
+
def __index__(self) -> int:
|
|
61
|
+
...
|
|
62
|
+
def __init__(self, value: int) -> None:
|
|
63
|
+
...
|
|
64
|
+
def __int__(self) -> int:
|
|
65
|
+
...
|
|
66
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
67
|
+
...
|
|
68
|
+
def __repr__(self) -> str:
|
|
69
|
+
...
|
|
70
|
+
def __setstate__(self, state: int) -> None:
|
|
71
|
+
...
|
|
72
|
+
def __str__(self) -> str:
|
|
73
|
+
...
|
|
74
|
+
@property
|
|
75
|
+
def name(self) -> str:
|
|
76
|
+
...
|
|
77
|
+
@property
|
|
78
|
+
def value(self) -> int:
|
|
79
|
+
...
|
|
80
|
+
__hash__: typing.ClassVar[None] = None
|
|
81
|
+
@staticmethod
|
|
82
|
+
def empty() -> Intersection:
|
|
83
|
+
"""
|
|
84
|
+
Create an empty intersection.
|
|
85
|
+
|
|
86
|
+
Returns:
|
|
87
|
+
Intersection: An empty intersection.
|
|
88
|
+
|
|
89
|
+
Example:
|
|
90
|
+
>>> intersection = Intersection.empty()
|
|
91
|
+
>>> intersection.is_empty() # True
|
|
92
|
+
"""
|
|
93
|
+
@staticmethod
|
|
94
|
+
def line(line: object.Line) -> Intersection:
|
|
95
|
+
"""
|
|
96
|
+
Create an intersection from a line.
|
|
97
|
+
|
|
98
|
+
Args:
|
|
99
|
+
line (Line): The line.
|
|
100
|
+
|
|
101
|
+
Returns:
|
|
102
|
+
Intersection: An intersection containing the line.
|
|
103
|
+
|
|
104
|
+
Example:
|
|
105
|
+
>>> intersection = Intersection.line(Line(Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)))
|
|
106
|
+
>>> intersection.is_defined() # True
|
|
107
|
+
"""
|
|
108
|
+
@staticmethod
|
|
109
|
+
def point(point: object.Point) -> Intersection:
|
|
110
|
+
"""
|
|
111
|
+
Create an intersection from a point.
|
|
112
|
+
|
|
113
|
+
Args:
|
|
114
|
+
point (Point): The point.
|
|
115
|
+
|
|
116
|
+
Returns:
|
|
117
|
+
Intersection: An intersection containing the point.
|
|
118
|
+
|
|
119
|
+
Example:
|
|
120
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0, 3.0))
|
|
121
|
+
>>> intersection.is_defined() # True
|
|
122
|
+
"""
|
|
123
|
+
@staticmethod
|
|
124
|
+
def point_set(point_set: object.PointSet) -> Intersection:
|
|
125
|
+
"""
|
|
126
|
+
Create an intersection from a point set.
|
|
127
|
+
|
|
128
|
+
Args:
|
|
129
|
+
point_set (PointSet): The point set.
|
|
130
|
+
|
|
131
|
+
Returns:
|
|
132
|
+
Intersection: An intersection containing the point set.
|
|
133
|
+
|
|
134
|
+
Example:
|
|
135
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
136
|
+
>>> intersection.is_defined() # True
|
|
137
|
+
"""
|
|
138
|
+
@staticmethod
|
|
139
|
+
def ray(ray: object.Ray) -> Intersection:
|
|
140
|
+
"""
|
|
141
|
+
Create an intersection from a ray.
|
|
142
|
+
|
|
143
|
+
Args:
|
|
144
|
+
ray (Ray): The ray.
|
|
145
|
+
|
|
146
|
+
Returns:
|
|
147
|
+
Intersection: An intersection containing the ray.
|
|
148
|
+
|
|
149
|
+
Example:
|
|
150
|
+
>>> intersection = Intersection.ray(Ray(Point(1.0, 2.0, 3.0), Vector(3.0, 4.0, 5.0)))
|
|
151
|
+
>>> intersection.is_defined() # True
|
|
152
|
+
"""
|
|
153
|
+
@staticmethod
|
|
154
|
+
def segment(segment: object.Segment) -> Intersection:
|
|
155
|
+
"""
|
|
156
|
+
Create an intersection from a segment.
|
|
157
|
+
|
|
158
|
+
Args:
|
|
159
|
+
segment (Segment): The segment.
|
|
160
|
+
|
|
161
|
+
Returns:
|
|
162
|
+
Intersection: An intersection containing the segment.
|
|
163
|
+
|
|
164
|
+
Example:
|
|
165
|
+
>>> intersection = Intersection.segment(Segment(Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)))
|
|
166
|
+
>>> intersection.is_defined() # True
|
|
167
|
+
"""
|
|
168
|
+
@staticmethod
|
|
169
|
+
def string_from_type(type: typing.Any) -> ostk.core.type.String:
|
|
170
|
+
"""
|
|
171
|
+
Convert an intersection type to a string.
|
|
172
|
+
|
|
173
|
+
Args:
|
|
174
|
+
type (Intersection.Type): The intersection type.
|
|
175
|
+
|
|
176
|
+
Returns:
|
|
177
|
+
str: The string representation of the type.
|
|
178
|
+
|
|
179
|
+
Example:
|
|
180
|
+
>>> Intersection.string_from_type(Intersection.Type.Point) # "Point"
|
|
181
|
+
"""
|
|
182
|
+
@staticmethod
|
|
183
|
+
def undefined() -> Intersection:
|
|
184
|
+
"""
|
|
185
|
+
Create an undefined intersection.
|
|
186
|
+
|
|
187
|
+
Returns:
|
|
188
|
+
Intersection: An undefined intersection.
|
|
189
|
+
|
|
190
|
+
Example:
|
|
191
|
+
>>> intersection = Intersection.undefined()
|
|
192
|
+
>>> intersection.is_defined() # False
|
|
193
|
+
"""
|
|
194
|
+
def __add__(self, arg0: Intersection) -> Intersection:
|
|
195
|
+
...
|
|
196
|
+
def __eq__(self, arg0: Intersection) -> bool:
|
|
197
|
+
...
|
|
198
|
+
def __iadd__(self, arg0: Intersection) -> Intersection:
|
|
199
|
+
...
|
|
200
|
+
def __ne__(self, arg0: Intersection) -> bool:
|
|
201
|
+
...
|
|
202
|
+
def __repr__(self) -> str:
|
|
203
|
+
...
|
|
204
|
+
def __str__(self) -> str:
|
|
205
|
+
...
|
|
206
|
+
def access_composite(self) -> object.Composite:
|
|
207
|
+
"""
|
|
208
|
+
Access the composite object in the intersection.
|
|
209
|
+
|
|
210
|
+
Returns:
|
|
211
|
+
Composite: Reference to the composite object.
|
|
212
|
+
|
|
213
|
+
Example:
|
|
214
|
+
>>> composite = intersection.access_composite()
|
|
215
|
+
"""
|
|
216
|
+
def as_composite(self) -> object.Composite:
|
|
217
|
+
"""
|
|
218
|
+
Convert the intersection to a composite.
|
|
219
|
+
|
|
220
|
+
Returns:
|
|
221
|
+
Composite: The intersection as a composite object.
|
|
222
|
+
|
|
223
|
+
Example:
|
|
224
|
+
>>> composite = intersection.as_composite()
|
|
225
|
+
"""
|
|
226
|
+
def as_ellipsoid(self) -> object.Ellipsoid:
|
|
227
|
+
"""
|
|
228
|
+
Convert the intersection to an ellipsoid.
|
|
229
|
+
|
|
230
|
+
Returns:
|
|
231
|
+
Ellipsoid: The intersection as an ellipsoid.
|
|
232
|
+
|
|
233
|
+
Example:
|
|
234
|
+
>>> ellipsoid = intersection.as_ellipsoid()
|
|
235
|
+
"""
|
|
236
|
+
def as_line(self) -> object.Line:
|
|
237
|
+
"""
|
|
238
|
+
Convert the intersection to a line.
|
|
239
|
+
|
|
240
|
+
Returns:
|
|
241
|
+
Line: The intersection as a line.
|
|
242
|
+
|
|
243
|
+
Example:
|
|
244
|
+
>>> intersection = Intersection.line(Line.points(Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)))
|
|
245
|
+
>>> line = intersection.as_line()
|
|
246
|
+
"""
|
|
247
|
+
def as_line_string(self) -> object.LineString:
|
|
248
|
+
"""
|
|
249
|
+
Convert the intersection to a line string.
|
|
250
|
+
|
|
251
|
+
Returns:
|
|
252
|
+
LineString: The intersection as a line string.
|
|
253
|
+
|
|
254
|
+
Example:
|
|
255
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
256
|
+
>>> line_string = intersection.as_line_string()
|
|
257
|
+
"""
|
|
258
|
+
def as_plane(self) -> object.Plane:
|
|
259
|
+
"""
|
|
260
|
+
Convert the intersection to a plane.
|
|
261
|
+
|
|
262
|
+
Returns:
|
|
263
|
+
Plane: The intersection as a plane.
|
|
264
|
+
|
|
265
|
+
Example:
|
|
266
|
+
>>> plane = intersection.as_plane()
|
|
267
|
+
"""
|
|
268
|
+
def as_point(self) -> object.Point:
|
|
269
|
+
"""
|
|
270
|
+
Convert the intersection to a point.
|
|
271
|
+
|
|
272
|
+
Returns:
|
|
273
|
+
Point: The intersection as a point.
|
|
274
|
+
|
|
275
|
+
Example:
|
|
276
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0, 3.0))
|
|
277
|
+
>>> point = intersection.as_point()
|
|
278
|
+
"""
|
|
279
|
+
def as_point_set(self) -> object.PointSet:
|
|
280
|
+
"""
|
|
281
|
+
Convert the intersection to a point set.
|
|
282
|
+
|
|
283
|
+
Returns:
|
|
284
|
+
PointSet: The intersection as a point set.
|
|
285
|
+
|
|
286
|
+
Example:
|
|
287
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
288
|
+
>>> point_set = intersection.as_point_set()
|
|
289
|
+
"""
|
|
290
|
+
def as_polygon(self) -> object.Polygon:
|
|
291
|
+
"""
|
|
292
|
+
Convert the intersection to a polygon.
|
|
293
|
+
|
|
294
|
+
Returns:
|
|
295
|
+
Polygon: The intersection as a polygon.
|
|
296
|
+
|
|
297
|
+
Example:
|
|
298
|
+
>>> polygon = intersection.as_polygon()
|
|
299
|
+
"""
|
|
300
|
+
def as_pyramid(self) -> object.Pyramid:
|
|
301
|
+
"""
|
|
302
|
+
Convert the intersection to a pyramid.
|
|
303
|
+
|
|
304
|
+
Returns:
|
|
305
|
+
Pyramid: The intersection as a pyramid.
|
|
306
|
+
|
|
307
|
+
Example:
|
|
308
|
+
>>> pyramid = intersection.as_pyramid()
|
|
309
|
+
"""
|
|
310
|
+
def as_ray(self) -> object.Ray:
|
|
311
|
+
"""
|
|
312
|
+
Convert the intersection to a ray.
|
|
313
|
+
|
|
314
|
+
Returns:
|
|
315
|
+
Ray: The intersection as a ray.
|
|
316
|
+
|
|
317
|
+
Example:
|
|
318
|
+
>>> intersection = Intersection.ray(Ray(Point(1.0, 2.0, 3.0), np.array([3.0, 4.0, 5.0])))
|
|
319
|
+
>>> ray = intersection.as_ray()
|
|
320
|
+
"""
|
|
321
|
+
def as_segment(self) -> object.Segment:
|
|
322
|
+
"""
|
|
323
|
+
Convert the intersection to a segment.
|
|
324
|
+
|
|
325
|
+
Returns:
|
|
326
|
+
Segment: The intersection as a segment.
|
|
327
|
+
|
|
328
|
+
Example:
|
|
329
|
+
>>> intersection = Intersection.segment(Segment(Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)))
|
|
330
|
+
>>> segment = intersection.as_segment()
|
|
331
|
+
"""
|
|
332
|
+
def as_sphere(self) -> object.Sphere:
|
|
333
|
+
"""
|
|
334
|
+
Convert the intersection to a sphere.
|
|
335
|
+
|
|
336
|
+
Returns:
|
|
337
|
+
Sphere: The intersection as a sphere.
|
|
338
|
+
|
|
339
|
+
Example:
|
|
340
|
+
>>> sphere = intersection.as_sphere()
|
|
341
|
+
"""
|
|
342
|
+
def get_type(self) -> ...:
|
|
343
|
+
"""
|
|
344
|
+
Get the type of the intersection.
|
|
345
|
+
|
|
346
|
+
Returns:
|
|
347
|
+
Intersection.Type: The type of the intersection.
|
|
348
|
+
|
|
349
|
+
Example:
|
|
350
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0, 3.0))
|
|
351
|
+
>>> intersection.get_type() # Intersection.Type.Point
|
|
352
|
+
"""
|
|
353
|
+
def is_complex(self) -> bool:
|
|
354
|
+
"""
|
|
355
|
+
Check if the intersection is complex (contains multiple objects).
|
|
356
|
+
|
|
357
|
+
Returns:
|
|
358
|
+
bool: True if the intersection contains multiple objects.
|
|
359
|
+
|
|
360
|
+
Example:
|
|
361
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0, 3.0)) + Intersection.point(Point(3.0, 4.0, 5.0))
|
|
362
|
+
>>> intersection.is_complex() # True
|
|
363
|
+
"""
|
|
364
|
+
def is_composite(self) -> bool:
|
|
365
|
+
"""
|
|
366
|
+
Check if the intersection is a composite.
|
|
367
|
+
|
|
368
|
+
Returns:
|
|
369
|
+
bool: True if the intersection contains a composite object.
|
|
370
|
+
|
|
371
|
+
Example:
|
|
372
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0), Point(3.0, 4.0)]))
|
|
373
|
+
>>> intersection.is_composite() # False
|
|
374
|
+
"""
|
|
375
|
+
def is_defined(self) -> bool:
|
|
376
|
+
"""
|
|
377
|
+
Check if the intersection is defined.
|
|
378
|
+
|
|
379
|
+
Returns:
|
|
380
|
+
bool: True if the intersection is defined.
|
|
381
|
+
|
|
382
|
+
Example:
|
|
383
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0, 3.0))
|
|
384
|
+
>>> intersection.is_defined() # True
|
|
385
|
+
"""
|
|
386
|
+
def is_ellipsoid(self) -> bool:
|
|
387
|
+
"""
|
|
388
|
+
Check if the intersection is an ellipsoid.
|
|
389
|
+
|
|
390
|
+
Returns:
|
|
391
|
+
bool: True if the intersection contains an ellipsoid.
|
|
392
|
+
|
|
393
|
+
Example:
|
|
394
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
395
|
+
>>> intersection.is_ellipsoid() # False
|
|
396
|
+
"""
|
|
397
|
+
def is_empty(self) -> bool:
|
|
398
|
+
"""
|
|
399
|
+
Check if the intersection is empty.
|
|
400
|
+
|
|
401
|
+
Returns:
|
|
402
|
+
bool: True if the intersection contains no objects.
|
|
403
|
+
|
|
404
|
+
Example:
|
|
405
|
+
>>> intersection = Intersection.empty()
|
|
406
|
+
>>> intersection.is_empty() # True
|
|
407
|
+
"""
|
|
408
|
+
def is_line(self) -> bool:
|
|
409
|
+
"""
|
|
410
|
+
Check if the intersection is a line.
|
|
411
|
+
|
|
412
|
+
Returns:
|
|
413
|
+
bool: True if the intersection contains a line.
|
|
414
|
+
|
|
415
|
+
Example:
|
|
416
|
+
>>> intersection = Intersection.line(Line.points(Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)))
|
|
417
|
+
>>> intersection.is_line() # True
|
|
418
|
+
"""
|
|
419
|
+
def is_line_string(self) -> bool:
|
|
420
|
+
"""
|
|
421
|
+
Check if the intersection is a line string.
|
|
422
|
+
|
|
423
|
+
Returns:
|
|
424
|
+
bool: True if the intersection contains a line string.
|
|
425
|
+
|
|
426
|
+
Example:
|
|
427
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
428
|
+
>>> intersection.is_line_string() # False
|
|
429
|
+
"""
|
|
430
|
+
def is_plane(self) -> bool:
|
|
431
|
+
"""
|
|
432
|
+
Check if the intersection is a plane.
|
|
433
|
+
|
|
434
|
+
Returns:
|
|
435
|
+
bool: True if the intersection contains a plane.
|
|
436
|
+
|
|
437
|
+
Example:
|
|
438
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
439
|
+
>>> intersection.is_plane() # False
|
|
440
|
+
"""
|
|
441
|
+
def is_point(self) -> bool:
|
|
442
|
+
"""
|
|
443
|
+
Check if the intersection is a point.
|
|
444
|
+
|
|
445
|
+
Returns:
|
|
446
|
+
bool: True if the intersection contains a single point.
|
|
447
|
+
|
|
448
|
+
Example:
|
|
449
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0, 3.0))
|
|
450
|
+
>>> intersection.is_point() # True
|
|
451
|
+
"""
|
|
452
|
+
def is_point_set(self) -> bool:
|
|
453
|
+
"""
|
|
454
|
+
Check if the intersection is a point set.
|
|
455
|
+
|
|
456
|
+
Returns:
|
|
457
|
+
bool: True if the intersection contains a point set.
|
|
458
|
+
|
|
459
|
+
Example:
|
|
460
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
461
|
+
>>> intersection.is_point_set() # True
|
|
462
|
+
"""
|
|
463
|
+
def is_polygon(self) -> bool:
|
|
464
|
+
"""
|
|
465
|
+
Check if the intersection is a polygon.
|
|
466
|
+
|
|
467
|
+
Returns:
|
|
468
|
+
bool: True if the intersection contains a polygon.
|
|
469
|
+
|
|
470
|
+
Example:
|
|
471
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
472
|
+
>>> intersection.is_polygon() # False
|
|
473
|
+
"""
|
|
474
|
+
def is_pyramid(self) -> bool:
|
|
475
|
+
"""
|
|
476
|
+
Check if the intersection is a pyramid.
|
|
477
|
+
|
|
478
|
+
Returns:
|
|
479
|
+
bool: True if the intersection contains a pyramid.
|
|
480
|
+
|
|
481
|
+
Example:
|
|
482
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0), Point(3.0, 4.0)]))
|
|
483
|
+
>>> intersection.is_pyramid() # False
|
|
484
|
+
"""
|
|
485
|
+
def is_ray(self) -> bool:
|
|
486
|
+
"""
|
|
487
|
+
Check if the intersection is a ray.
|
|
488
|
+
|
|
489
|
+
Returns:
|
|
490
|
+
bool: True if the intersection contains a ray.
|
|
491
|
+
|
|
492
|
+
Example:
|
|
493
|
+
>>> intersection = Intersection.ray(Ray(Point(1.0, 2.0, 3.0), np.array([3.0, 4.0, 5.0])))
|
|
494
|
+
>>> intersection.is_ray() # True
|
|
495
|
+
"""
|
|
496
|
+
def is_segment(self) -> bool:
|
|
497
|
+
"""
|
|
498
|
+
Check if the intersection is a segment.
|
|
499
|
+
|
|
500
|
+
Returns:
|
|
501
|
+
bool: True if the intersection contains a segment.
|
|
502
|
+
|
|
503
|
+
Example:
|
|
504
|
+
>>> intersection = Intersection.segment(Segment(Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)))
|
|
505
|
+
>>> intersection.is_segment() # True
|
|
506
|
+
"""
|
|
507
|
+
def is_sphere(self) -> bool:
|
|
508
|
+
"""
|
|
509
|
+
Check if the intersection is a sphere.
|
|
510
|
+
|
|
511
|
+
Returns:
|
|
512
|
+
bool: True if the intersection contains a sphere.
|
|
513
|
+
|
|
514
|
+
Example:
|
|
515
|
+
>>> intersection = Intersection.point_set(PointSet([Point(1.0, 2.0, 3.0), Point(3.0, 4.0, 5.0)]))
|
|
516
|
+
>>> intersection.is_sphere() # False
|
|
517
|
+
"""
|
|
518
|
+
class Object:
|
|
519
|
+
"""
|
|
520
|
+
|
|
521
|
+
Base class for 3D geometric objects.
|
|
522
|
+
|
|
523
|
+
Object is the abstract base class for all 3D geometric primitives and shapes.
|
|
524
|
+
|
|
525
|
+
"""
|
|
526
|
+
__hash__: typing.ClassVar[None] = None
|
|
527
|
+
def __eq__(self, arg0: Object) -> bool:
|
|
528
|
+
...
|
|
529
|
+
def __ne__(self, arg0: Object) -> bool:
|
|
530
|
+
...
|
|
531
|
+
def __repr__(self) -> str:
|
|
532
|
+
...
|
|
533
|
+
def __str__(self) -> str:
|
|
534
|
+
...
|
|
535
|
+
def apply_transformation(self, transformation: typing.Any) -> None:
|
|
536
|
+
"""
|
|
537
|
+
Apply a transformation to the object in place
|
|
538
|
+
|
|
539
|
+
Args:
|
|
540
|
+
transformation (Transformation): The transformation to apply.
|
|
541
|
+
"""
|
|
542
|
+
def as_cone(self) -> ...:
|
|
543
|
+
"""
|
|
544
|
+
Convert the object to a cone.
|
|
545
|
+
|
|
546
|
+
Returns:
|
|
547
|
+
Cone: The cone.
|
|
548
|
+
"""
|
|
549
|
+
def as_ellipsoid(self) -> ...:
|
|
550
|
+
"""
|
|
551
|
+
Convert the object to an ellipsoid.
|
|
552
|
+
|
|
553
|
+
Returns:
|
|
554
|
+
Ellipsoid: The ellipsoid.
|
|
555
|
+
"""
|
|
556
|
+
def as_line(self) -> ...:
|
|
557
|
+
"""
|
|
558
|
+
Convert the object to a line.
|
|
559
|
+
|
|
560
|
+
Returns:
|
|
561
|
+
Line: The line.
|
|
562
|
+
"""
|
|
563
|
+
def as_line_string(self) -> ...:
|
|
564
|
+
"""
|
|
565
|
+
Convert the object to a line string.
|
|
566
|
+
|
|
567
|
+
Returns:
|
|
568
|
+
LineString: The line string.
|
|
569
|
+
"""
|
|
570
|
+
def as_plane(self) -> ...:
|
|
571
|
+
"""
|
|
572
|
+
Convert the object to a plane.
|
|
573
|
+
|
|
574
|
+
Returns:
|
|
575
|
+
Plane: The plane.
|
|
576
|
+
"""
|
|
577
|
+
def as_point(self) -> ...:
|
|
578
|
+
"""
|
|
579
|
+
Convert the object to a point.
|
|
580
|
+
|
|
581
|
+
Returns:
|
|
582
|
+
Point: The point.
|
|
583
|
+
"""
|
|
584
|
+
def as_point_set(self) -> ...:
|
|
585
|
+
"""
|
|
586
|
+
Convert the object to a point set.
|
|
587
|
+
|
|
588
|
+
Returns:
|
|
589
|
+
PointSet: The point set.
|
|
590
|
+
"""
|
|
591
|
+
def as_polygon(self) -> ...:
|
|
592
|
+
"""
|
|
593
|
+
Convert the object to a polygon.
|
|
594
|
+
|
|
595
|
+
Returns:
|
|
596
|
+
Polygon: The polygon.
|
|
597
|
+
"""
|
|
598
|
+
def as_pyramid(self) -> ...:
|
|
599
|
+
"""
|
|
600
|
+
Convert the object to a pyramid.
|
|
601
|
+
|
|
602
|
+
Returns:
|
|
603
|
+
Pyramid: The pyramid.
|
|
604
|
+
"""
|
|
605
|
+
def as_ray(self) -> ...:
|
|
606
|
+
"""
|
|
607
|
+
Convert the object to a ray.
|
|
608
|
+
|
|
609
|
+
Returns:
|
|
610
|
+
Ray: The ray.
|
|
611
|
+
"""
|
|
612
|
+
def as_segment(self) -> ...:
|
|
613
|
+
"""
|
|
614
|
+
Convert the object to a segment.
|
|
615
|
+
|
|
616
|
+
Returns:
|
|
617
|
+
Segment: The segment.
|
|
618
|
+
"""
|
|
619
|
+
def as_sphere(self) -> ...:
|
|
620
|
+
"""
|
|
621
|
+
Convert the object to a sphere.
|
|
622
|
+
|
|
623
|
+
Returns:
|
|
624
|
+
Sphere: The sphere.
|
|
625
|
+
"""
|
|
626
|
+
def contains(self, arg0: Object) -> bool:
|
|
627
|
+
"""
|
|
628
|
+
Check if this object contains another object.
|
|
629
|
+
|
|
630
|
+
Args:
|
|
631
|
+
object (Object): The object to check containment of.
|
|
632
|
+
|
|
633
|
+
Returns:
|
|
634
|
+
bool: True if this object contains the other object.
|
|
635
|
+
|
|
636
|
+
Example:
|
|
637
|
+
>>> object = Cone(Point(1.0, 2.0, 3.0), [0.0, 0.0, 1.0], Angle.degrees(30.0))
|
|
638
|
+
>>> other_object = Point(1.0, 2.0, 3.1)
|
|
639
|
+
>>> object.contains(other_object) # True
|
|
640
|
+
"""
|
|
641
|
+
def intersects(self, arg0: Object) -> bool:
|
|
642
|
+
"""
|
|
643
|
+
Check if this object intersects another object.
|
|
644
|
+
|
|
645
|
+
Args:
|
|
646
|
+
object (Object): The object to check intersection with.
|
|
647
|
+
|
|
648
|
+
Returns:
|
|
649
|
+
bool: True if the objects intersect.
|
|
650
|
+
|
|
651
|
+
Example:
|
|
652
|
+
>>> object = Cone(Point(1.0, 2.0, 3.0), [0.0, 0.0, 1.0], Angle.degrees(30.0))
|
|
653
|
+
>>> other_object = Point(1.0, 2.0, 3.1)
|
|
654
|
+
>>> object.intersects(other_object) # True
|
|
655
|
+
"""
|
|
656
|
+
def is_cone(self) -> bool:
|
|
657
|
+
"""
|
|
658
|
+
Check if the object is a cone.
|
|
659
|
+
|
|
660
|
+
Returns:
|
|
661
|
+
bool: True if the object is a cone.
|
|
662
|
+
"""
|
|
663
|
+
def is_defined(self) -> bool:
|
|
664
|
+
"""
|
|
665
|
+
Check if the object is defined.
|
|
666
|
+
|
|
667
|
+
Returns:
|
|
668
|
+
bool: True if the object is defined.
|
|
669
|
+
|
|
670
|
+
Example:
|
|
671
|
+
>>> object = Point(1.0, 2.0, 3.0)
|
|
672
|
+
>>> object.is_defined() # True
|
|
673
|
+
"""
|
|
674
|
+
def is_ellipsoid(self) -> bool:
|
|
675
|
+
"""
|
|
676
|
+
Check if the object is an ellipsoid.
|
|
677
|
+
|
|
678
|
+
Returns:
|
|
679
|
+
bool: True if the object is an ellipsoid.
|
|
680
|
+
"""
|
|
681
|
+
def is_line(self) -> bool:
|
|
682
|
+
"""
|
|
683
|
+
Check if the object is a line.
|
|
684
|
+
|
|
685
|
+
Returns:
|
|
686
|
+
bool: True if the object is a line.
|
|
687
|
+
"""
|
|
688
|
+
def is_line_string(self) -> bool:
|
|
689
|
+
"""
|
|
690
|
+
Check if the object is a line string.
|
|
691
|
+
|
|
692
|
+
Returns:
|
|
693
|
+
bool: True if the object is a line string.
|
|
694
|
+
"""
|
|
695
|
+
def is_plane(self) -> bool:
|
|
696
|
+
"""
|
|
697
|
+
Check if the object is a plane.
|
|
698
|
+
|
|
699
|
+
Returns:
|
|
700
|
+
bool: True if the object is a plane.
|
|
701
|
+
"""
|
|
702
|
+
def is_point(self) -> bool:
|
|
703
|
+
"""
|
|
704
|
+
Check if the object is a point.
|
|
705
|
+
|
|
706
|
+
Returns:
|
|
707
|
+
bool: True if the object is a point.
|
|
708
|
+
"""
|
|
709
|
+
def is_point_set(self) -> bool:
|
|
710
|
+
"""
|
|
711
|
+
Check if the object is a point set.
|
|
712
|
+
|
|
713
|
+
Returns:
|
|
714
|
+
bool: True if the object is a point set.
|
|
715
|
+
"""
|
|
716
|
+
def is_polygon(self) -> bool:
|
|
717
|
+
"""
|
|
718
|
+
Check if the object is a polygon.
|
|
719
|
+
|
|
720
|
+
Returns:
|
|
721
|
+
bool: True if the object is a polygon.
|
|
722
|
+
"""
|
|
723
|
+
def is_pyramid(self) -> bool:
|
|
724
|
+
"""
|
|
725
|
+
Check if the object is a pyramid.
|
|
726
|
+
|
|
727
|
+
Returns:
|
|
728
|
+
bool: True if the object is a pyramid.
|
|
729
|
+
"""
|
|
730
|
+
def is_ray(self) -> bool:
|
|
731
|
+
"""
|
|
732
|
+
Check if the object is a ray.
|
|
733
|
+
|
|
734
|
+
Returns:
|
|
735
|
+
bool: True if the object is a ray.
|
|
736
|
+
"""
|
|
737
|
+
def is_segment(self) -> bool:
|
|
738
|
+
"""
|
|
739
|
+
Check if the object is a segment.
|
|
740
|
+
|
|
741
|
+
Returns:
|
|
742
|
+
bool: True if the object is a segment.
|
|
743
|
+
"""
|
|
744
|
+
def is_sphere(self) -> bool:
|
|
745
|
+
"""
|
|
746
|
+
Check if the object is a sphere.
|
|
747
|
+
|
|
748
|
+
Returns:
|
|
749
|
+
bool: True if the object is a sphere.
|
|
750
|
+
"""
|
|
751
|
+
class Transformation:
|
|
752
|
+
"""
|
|
753
|
+
|
|
754
|
+
Represents a 3D geometric transformation.
|
|
755
|
+
|
|
756
|
+
A Transformation can represent translation, rotation, scaling, reflection, shear, or general affine transformations.
|
|
757
|
+
|
|
758
|
+
"""
|
|
759
|
+
class Type:
|
|
760
|
+
"""
|
|
761
|
+
Members:
|
|
762
|
+
|
|
763
|
+
Undefined
|
|
764
|
+
|
|
765
|
+
Identity
|
|
766
|
+
|
|
767
|
+
Translation
|
|
768
|
+
|
|
769
|
+
Rotation
|
|
770
|
+
|
|
771
|
+
Scaling
|
|
772
|
+
|
|
773
|
+
Reflection
|
|
774
|
+
|
|
775
|
+
Shear
|
|
776
|
+
|
|
777
|
+
Affine
|
|
778
|
+
"""
|
|
779
|
+
Affine: typing.ClassVar[Transformation.Type] # value = <Type.Affine: 7>
|
|
780
|
+
Identity: typing.ClassVar[Transformation.Type] # value = <Type.Identity: 1>
|
|
781
|
+
Reflection: typing.ClassVar[Transformation.Type] # value = <Type.Reflection: 5>
|
|
782
|
+
Rotation: typing.ClassVar[Transformation.Type] # value = <Type.Rotation: 3>
|
|
783
|
+
Scaling: typing.ClassVar[Transformation.Type] # value = <Type.Scaling: 4>
|
|
784
|
+
Shear: typing.ClassVar[Transformation.Type] # value = <Type.Shear: 6>
|
|
785
|
+
Translation: typing.ClassVar[Transformation.Type] # value = <Type.Translation: 2>
|
|
786
|
+
Undefined: typing.ClassVar[Transformation.Type] # value = <Type.Undefined: 0>
|
|
787
|
+
__members__: typing.ClassVar[dict[str, Transformation.Type]] # value = {'Undefined': <Type.Undefined: 0>, 'Identity': <Type.Identity: 1>, 'Translation': <Type.Translation: 2>, 'Rotation': <Type.Rotation: 3>, 'Scaling': <Type.Scaling: 4>, 'Reflection': <Type.Reflection: 5>, 'Shear': <Type.Shear: 6>, 'Affine': <Type.Affine: 7>}
|
|
788
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
789
|
+
...
|
|
790
|
+
def __getstate__(self) -> int:
|
|
791
|
+
...
|
|
792
|
+
def __hash__(self) -> int:
|
|
793
|
+
...
|
|
794
|
+
def __index__(self) -> int:
|
|
795
|
+
...
|
|
796
|
+
def __init__(self, value: int) -> None:
|
|
797
|
+
...
|
|
798
|
+
def __int__(self) -> int:
|
|
799
|
+
...
|
|
800
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
801
|
+
...
|
|
802
|
+
def __repr__(self) -> str:
|
|
803
|
+
...
|
|
804
|
+
def __setstate__(self, state: int) -> None:
|
|
805
|
+
...
|
|
806
|
+
def __str__(self) -> str:
|
|
807
|
+
...
|
|
808
|
+
@property
|
|
809
|
+
def name(self) -> str:
|
|
810
|
+
...
|
|
811
|
+
@property
|
|
812
|
+
def value(self) -> int:
|
|
813
|
+
...
|
|
814
|
+
__hash__: typing.ClassVar[None] = None
|
|
815
|
+
@staticmethod
|
|
816
|
+
def identity() -> Transformation:
|
|
817
|
+
"""
|
|
818
|
+
Create an identity transformation.
|
|
819
|
+
|
|
820
|
+
Returns:
|
|
821
|
+
Transformation: An identity transformation.
|
|
822
|
+
|
|
823
|
+
Example:
|
|
824
|
+
>>> transformation = Transformation.identity()
|
|
825
|
+
>>> transformation.is_defined() # True
|
|
826
|
+
"""
|
|
827
|
+
@staticmethod
|
|
828
|
+
@typing.overload
|
|
829
|
+
def rotation(rotation_vector: typing.Any) -> Transformation:
|
|
830
|
+
"""
|
|
831
|
+
Create a rotation transformation from a rotation vector.
|
|
832
|
+
|
|
833
|
+
Args:
|
|
834
|
+
rotation_vector (RotationVector): The rotation vector.
|
|
835
|
+
|
|
836
|
+
Returns:
|
|
837
|
+
Transformation: A rotation transformation.
|
|
838
|
+
|
|
839
|
+
Example:
|
|
840
|
+
>>> rotation_vector = RotationVector(1.0, 2.0, 3.0)
|
|
841
|
+
>>> transformation = Transformation.rotation(rotation_vector)
|
|
842
|
+
>>> transformation.is_defined() # True
|
|
843
|
+
"""
|
|
844
|
+
@staticmethod
|
|
845
|
+
@typing.overload
|
|
846
|
+
def rotation(rotation_matrix: typing.Any) -> Transformation:
|
|
847
|
+
"""
|
|
848
|
+
Create a rotation transformation from a rotation matrix.
|
|
849
|
+
|
|
850
|
+
Args:
|
|
851
|
+
rotation_matrix (RotationMatrix): The rotation matrix.
|
|
852
|
+
|
|
853
|
+
Returns:
|
|
854
|
+
Transformation: A rotation transformation.
|
|
855
|
+
|
|
856
|
+
Example:
|
|
857
|
+
>>> rotation_matrix = RotationMatrix(1.0, 2.0, 3.0)
|
|
858
|
+
>>> transformation = Transformation.rotation(rotation_matrix)
|
|
859
|
+
>>> transformation.is_defined() # True
|
|
860
|
+
"""
|
|
861
|
+
@staticmethod
|
|
862
|
+
def rotation_around(point: object.Point, rotation_vector: typing.Any) -> Transformation:
|
|
863
|
+
"""
|
|
864
|
+
Create a rotation transformation around a point.
|
|
865
|
+
|
|
866
|
+
Args:
|
|
867
|
+
point (Point): The point to rotate around.
|
|
868
|
+
rotation_vector (RotationVector): The rotation vector.
|
|
869
|
+
|
|
870
|
+
Returns:
|
|
871
|
+
Transformation: A rotation transformation around the point.
|
|
872
|
+
|
|
873
|
+
Example:
|
|
874
|
+
>>> point = Point(1.0, 2.0, 3.0)
|
|
875
|
+
>>> rotation_vector = RotationVector(1.0, 2.0, 3.0)
|
|
876
|
+
>>> transformation = Transformation.rotation_around(point, rotation_vector)
|
|
877
|
+
>>> transformation.is_defined() # True
|
|
878
|
+
"""
|
|
879
|
+
@staticmethod
|
|
880
|
+
def string_from_type(type: typing.Any) -> ostk.core.type.String:
|
|
881
|
+
"""
|
|
882
|
+
Convert a transformation type to a string.
|
|
883
|
+
|
|
884
|
+
Args:
|
|
885
|
+
type (Transformation.Type): The transformation type.
|
|
886
|
+
|
|
887
|
+
Returns:
|
|
888
|
+
str: The string representation of the type.
|
|
889
|
+
|
|
890
|
+
Example:
|
|
891
|
+
>>> transformation = Transformation.identity()
|
|
892
|
+
>>> transformation.string_from_type() # "Identity"
|
|
893
|
+
"""
|
|
894
|
+
@staticmethod
|
|
895
|
+
def translation(translation_vector: numpy.ndarray[numpy.float64[3, 1]]) -> Transformation:
|
|
896
|
+
"""
|
|
897
|
+
Create a translation transformation.
|
|
898
|
+
|
|
899
|
+
Args:
|
|
900
|
+
translation_vector (numpy.ndarray): The translation vector.
|
|
901
|
+
|
|
902
|
+
Returns:
|
|
903
|
+
Transformation: A translation transformation.
|
|
904
|
+
|
|
905
|
+
Example:
|
|
906
|
+
>>> translation_vector = Vector3d(1.0, 2.0, 3.0)
|
|
907
|
+
>>> transformation = Transformation.translation(translation_vector)
|
|
908
|
+
>>> transformation.is_defined() # True
|
|
909
|
+
"""
|
|
910
|
+
@staticmethod
|
|
911
|
+
def type_of_matrix(matrix: numpy.ndarray[numpy.float64[4, 4]]) -> ...:
|
|
912
|
+
"""
|
|
913
|
+
Determine the type of a transformation matrix.
|
|
914
|
+
|
|
915
|
+
Args:
|
|
916
|
+
matrix (numpy.ndarray): The 4x4 transformation matrix.
|
|
917
|
+
|
|
918
|
+
Returns:
|
|
919
|
+
Transformation.Type: The type of the transformation.
|
|
920
|
+
|
|
921
|
+
Example:
|
|
922
|
+
>>> transformation = Transformation.identity()
|
|
923
|
+
>>> transformation.type_of_matrix() # Transformation.Type.Identity
|
|
924
|
+
"""
|
|
925
|
+
@staticmethod
|
|
926
|
+
def undefined() -> Transformation:
|
|
927
|
+
"""
|
|
928
|
+
Create an undefined transformation.
|
|
929
|
+
|
|
930
|
+
Returns:
|
|
931
|
+
Transformation: An undefined transformation.
|
|
932
|
+
|
|
933
|
+
Example:
|
|
934
|
+
>>> transformation = Transformation.undefined()
|
|
935
|
+
>>> transformation.is_defined() # False
|
|
936
|
+
"""
|
|
937
|
+
def __eq__(self, arg0: Transformation) -> bool:
|
|
938
|
+
...
|
|
939
|
+
def __init__(self, matrix: numpy.ndarray[numpy.float64[4, 4]]) -> None:
|
|
940
|
+
"""
|
|
941
|
+
Construct a transformation from a 4x4 matrix.
|
|
942
|
+
|
|
943
|
+
Args:
|
|
944
|
+
matrix (numpy.ndarray): A 4x4 transformation matrix.
|
|
945
|
+
|
|
946
|
+
Example:
|
|
947
|
+
>>> import numpy as np
|
|
948
|
+
>>> matrix = np.eye(3) # 3x3 identity matrix
|
|
949
|
+
>>> transformation = Transformation(matrix)
|
|
950
|
+
"""
|
|
951
|
+
def __ne__(self, arg0: Transformation) -> bool:
|
|
952
|
+
...
|
|
953
|
+
def __repr__(self) -> str:
|
|
954
|
+
...
|
|
955
|
+
def __str__(self) -> str:
|
|
956
|
+
...
|
|
957
|
+
@typing.overload
|
|
958
|
+
def apply_to(self, point: object.Point) -> object.Point:
|
|
959
|
+
"""
|
|
960
|
+
Apply the transformation to a point.
|
|
961
|
+
|
|
962
|
+
Args:
|
|
963
|
+
point (Point): The point to transform.
|
|
964
|
+
|
|
965
|
+
Returns:
|
|
966
|
+
Point: The transformed point.
|
|
967
|
+
|
|
968
|
+
Example:
|
|
969
|
+
>>> transformation = Transformation.identity()
|
|
970
|
+
>>> point = Point(1.0, 2.0, 3.0)
|
|
971
|
+
>>> transformed_point = transformation.apply_to(point) # Point(1.0, 2.0, 3.0)
|
|
972
|
+
"""
|
|
973
|
+
@typing.overload
|
|
974
|
+
def apply_to(self, vector: numpy.ndarray[numpy.float64[3, 1]]) -> numpy.ndarray[numpy.float64[3, 1]]:
|
|
975
|
+
"""
|
|
976
|
+
Apply the transformation to a vector.
|
|
977
|
+
|
|
978
|
+
Args:
|
|
979
|
+
vector (numpy.ndarray): The vector to transform.
|
|
980
|
+
|
|
981
|
+
Returns:
|
|
982
|
+
numpy.ndarray: The transformed vector.
|
|
983
|
+
|
|
984
|
+
Example:
|
|
985
|
+
>>> transformation = Transformation.identity()
|
|
986
|
+
>>> vector = Vector3d(1.0, 2.0, 3.0)
|
|
987
|
+
>>> transformed_vector = transformation.apply_to(vector) # Vector3d(1.0, 2.0, 3.0)
|
|
988
|
+
"""
|
|
989
|
+
def get_inverse(self) -> Transformation:
|
|
990
|
+
"""
|
|
991
|
+
Get the inverse transformation.
|
|
992
|
+
|
|
993
|
+
Returns:
|
|
994
|
+
Transformation: The inverse transformation.
|
|
995
|
+
|
|
996
|
+
Example:
|
|
997
|
+
>>> transformation = Transformation.identity()
|
|
998
|
+
>>> inverse = transformation.get_inverse() # Identity transformation
|
|
999
|
+
"""
|
|
1000
|
+
def get_matrix(self) -> numpy.ndarray[numpy.float64[4, 4]]:
|
|
1001
|
+
"""
|
|
1002
|
+
Get the transformation matrix.
|
|
1003
|
+
|
|
1004
|
+
Returns:
|
|
1005
|
+
numpy.ndarray: The 4x4 transformation matrix.
|
|
1006
|
+
|
|
1007
|
+
Example:
|
|
1008
|
+
>>> transformation = Transformation.identity()
|
|
1009
|
+
>>> matrix = transformation.get_matrix() # 4x4 identity matrix
|
|
1010
|
+
"""
|
|
1011
|
+
def get_type(self) -> ...:
|
|
1012
|
+
"""
|
|
1013
|
+
Get the type of the transformation.
|
|
1014
|
+
|
|
1015
|
+
Returns:
|
|
1016
|
+
Transformation.Type: The transformation type.
|
|
1017
|
+
|
|
1018
|
+
Example:
|
|
1019
|
+
>>> transformation = Transformation.identity()
|
|
1020
|
+
>>> transformation.get_type() # Transformation.Type.Identity
|
|
1021
|
+
"""
|
|
1022
|
+
def is_defined(self) -> bool:
|
|
1023
|
+
"""
|
|
1024
|
+
Check if the transformation is defined.
|
|
1025
|
+
|
|
1026
|
+
Returns:
|
|
1027
|
+
bool: True if the transformation is defined.
|
|
1028
|
+
|
|
1029
|
+
Example:
|
|
1030
|
+
>>> transformation = Transformation.identity()
|
|
1031
|
+
>>> transformation.is_defined() # True
|
|
1032
|
+
"""
|