open-space-toolkit-mathematics 4.5.2__py312-none-manylinux2014_aarch64.whl → 4.5.4__py312-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.
Potentially problematic release.
This version of open-space-toolkit-mathematics might be problematic. Click here for more details.
- {open_space_toolkit_mathematics-4.5.2.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/METADATA +1 -1
- {open_space_toolkit_mathematics-4.5.2.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/RECORD +17 -17
- ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-312-aarch64-linux-gnu.so +0 -0
- ostk/mathematics/curve_fitting/__init__.pyi +97 -7
- ostk/mathematics/curve_fitting/interpolator.pyi +204 -16
- ostk/mathematics/geometry/__init__.pyi +364 -32
- ostk/mathematics/geometry/d2/__init__.pyi +560 -48
- ostk/mathematics/geometry/d2/object.pyi +1524 -126
- ostk/mathematics/geometry/d3/__init__.pyi +774 -78
- ostk/mathematics/geometry/d3/object.pyi +3164 -250
- ostk/mathematics/geometry/d3/transformation/rotation.pyi +1007 -91
- ostk/mathematics/libopen-space-toolkit-mathematics.so.4 +0 -0
- ostk/mathematics/object.pyi +292 -22
- ostk/mathematics/solver.pyi +220 -16
- {open_space_toolkit_mathematics-4.5.2.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/WHEEL +0 -0
- {open_space_toolkit_mathematics-4.5.2.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/top_level.txt +0 -0
- {open_space_toolkit_mathematics-4.5.2.dist-info → open_space_toolkit_mathematics-4.5.4.dist-info}/zip-safe +0 -0
|
@@ -6,6 +6,13 @@ from . import object
|
|
|
6
6
|
from . import transformation
|
|
7
7
|
__all__ = ['Intersection', 'Object', 'Transformation', 'object', 'transformation']
|
|
8
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
|
+
"""
|
|
9
16
|
class Type:
|
|
10
17
|
"""
|
|
11
18
|
Members:
|
|
@@ -73,28 +80,117 @@ class Intersection:
|
|
|
73
80
|
__hash__: typing.ClassVar[None] = None
|
|
74
81
|
@staticmethod
|
|
75
82
|
def empty() -> Intersection:
|
|
76
|
-
|
|
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
|
+
"""
|
|
77
93
|
@staticmethod
|
|
78
94
|
def line(line: object.Line) -> Intersection:
|
|
79
|
-
|
|
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
|
+
"""
|
|
80
108
|
@staticmethod
|
|
81
109
|
def point(point: object.Point) -> Intersection:
|
|
82
|
-
|
|
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
|
+
"""
|
|
83
123
|
@staticmethod
|
|
84
124
|
def point_set(point_set: object.PointSet) -> Intersection:
|
|
85
|
-
|
|
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
|
+
"""
|
|
86
138
|
@staticmethod
|
|
87
139
|
def ray(ray: object.Ray) -> Intersection:
|
|
88
|
-
|
|
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
|
+
"""
|
|
89
153
|
@staticmethod
|
|
90
154
|
def segment(segment: object.Segment) -> Intersection:
|
|
91
|
-
|
|
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
|
+
"""
|
|
92
168
|
@staticmethod
|
|
93
169
|
def string_from_type(type: typing.Any) -> ostk.core.type.String:
|
|
94
|
-
|
|
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
|
+
"""
|
|
95
182
|
@staticmethod
|
|
96
183
|
def undefined() -> Intersection:
|
|
97
|
-
|
|
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
|
+
"""
|
|
98
194
|
def __add__(self, arg0: Intersection) -> Intersection:
|
|
99
195
|
...
|
|
100
196
|
def __eq__(self, arg0: Intersection) -> bool:
|
|
@@ -108,64 +204,325 @@ class Intersection:
|
|
|
108
204
|
def __str__(self) -> str:
|
|
109
205
|
...
|
|
110
206
|
def access_composite(self) -> object.Composite:
|
|
111
|
-
|
|
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
|
+
"""
|
|
112
216
|
def as_composite(self) -> object.Composite:
|
|
113
|
-
|
|
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
|
+
"""
|
|
114
226
|
def as_ellipsoid(self) -> object.Ellipsoid:
|
|
115
|
-
|
|
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
|
+
"""
|
|
116
236
|
def as_line(self) -> object.Line:
|
|
117
|
-
|
|
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
|
+
"""
|
|
118
247
|
def as_line_string(self) -> object.LineString:
|
|
119
|
-
|
|
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
|
+
"""
|
|
120
258
|
def as_plane(self) -> object.Plane:
|
|
121
|
-
|
|
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
|
+
"""
|
|
122
268
|
def as_point(self) -> object.Point:
|
|
123
|
-
|
|
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
|
+
"""
|
|
124
279
|
def as_point_set(self) -> object.PointSet:
|
|
125
|
-
|
|
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
|
+
"""
|
|
126
290
|
def as_polygon(self) -> object.Polygon:
|
|
127
|
-
|
|
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
|
+
"""
|
|
128
300
|
def as_pyramid(self) -> object.Pyramid:
|
|
129
|
-
|
|
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
|
+
"""
|
|
130
310
|
def as_ray(self) -> object.Ray:
|
|
131
|
-
|
|
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
|
+
"""
|
|
132
321
|
def as_segment(self) -> object.Segment:
|
|
133
|
-
|
|
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
|
+
"""
|
|
134
332
|
def as_sphere(self) -> object.Sphere:
|
|
135
|
-
|
|
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
|
+
"""
|
|
136
342
|
def get_type(self) -> ...:
|
|
137
|
-
|
|
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
|
+
"""
|
|
138
353
|
def is_complex(self) -> bool:
|
|
139
|
-
|
|
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
|
+
"""
|
|
140
364
|
def is_composite(self) -> bool:
|
|
141
|
-
|
|
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
|
+
"""
|
|
142
375
|
def is_defined(self) -> bool:
|
|
143
|
-
|
|
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
|
+
"""
|
|
144
386
|
def is_ellipsoid(self) -> bool:
|
|
145
|
-
|
|
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
|
+
"""
|
|
146
397
|
def is_empty(self) -> bool:
|
|
147
|
-
|
|
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
|
+
"""
|
|
148
408
|
def is_line(self) -> bool:
|
|
149
|
-
|
|
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
|
+
"""
|
|
150
419
|
def is_line_string(self) -> bool:
|
|
151
|
-
|
|
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
|
+
"""
|
|
152
430
|
def is_plane(self) -> bool:
|
|
153
|
-
|
|
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
|
+
"""
|
|
154
441
|
def is_point(self) -> bool:
|
|
155
|
-
|
|
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
|
+
"""
|
|
156
452
|
def is_point_set(self) -> bool:
|
|
157
|
-
|
|
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
|
+
"""
|
|
158
463
|
def is_polygon(self) -> bool:
|
|
159
|
-
|
|
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
|
+
"""
|
|
160
474
|
def is_pyramid(self) -> bool:
|
|
161
|
-
|
|
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
|
+
"""
|
|
162
485
|
def is_ray(self) -> bool:
|
|
163
|
-
|
|
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
|
+
"""
|
|
164
496
|
def is_segment(self) -> bool:
|
|
165
|
-
|
|
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
|
+
"""
|
|
166
507
|
def is_sphere(self) -> bool:
|
|
167
|
-
|
|
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
|
+
"""
|
|
168
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
|
+
"""
|
|
169
526
|
__hash__: typing.ClassVar[None] = None
|
|
170
527
|
def __eq__(self, arg0: Object) -> bool:
|
|
171
528
|
...
|
|
@@ -176,58 +533,229 @@ class Object:
|
|
|
176
533
|
def __str__(self) -> str:
|
|
177
534
|
...
|
|
178
535
|
def apply_transformation(self, transformation: typing.Any) -> None:
|
|
179
|
-
|
|
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
|
+
"""
|
|
180
549
|
def as_ellipsoid(self) -> ...:
|
|
181
|
-
|
|
550
|
+
"""
|
|
551
|
+
Convert the object to an ellipsoid.
|
|
552
|
+
|
|
553
|
+
Returns:
|
|
554
|
+
Ellipsoid: The ellipsoid.
|
|
555
|
+
"""
|
|
182
556
|
def as_line(self) -> ...:
|
|
183
|
-
|
|
557
|
+
"""
|
|
558
|
+
Convert the object to a line.
|
|
559
|
+
|
|
560
|
+
Returns:
|
|
561
|
+
Line: The line.
|
|
562
|
+
"""
|
|
184
563
|
def as_line_string(self) -> ...:
|
|
185
|
-
|
|
564
|
+
"""
|
|
565
|
+
Convert the object to a line string.
|
|
566
|
+
|
|
567
|
+
Returns:
|
|
568
|
+
LineString: The line string.
|
|
569
|
+
"""
|
|
186
570
|
def as_plane(self) -> ...:
|
|
187
|
-
|
|
571
|
+
"""
|
|
572
|
+
Convert the object to a plane.
|
|
573
|
+
|
|
574
|
+
Returns:
|
|
575
|
+
Plane: The plane.
|
|
576
|
+
"""
|
|
188
577
|
def as_point(self) -> ...:
|
|
189
|
-
|
|
578
|
+
"""
|
|
579
|
+
Convert the object to a point.
|
|
580
|
+
|
|
581
|
+
Returns:
|
|
582
|
+
Point: The point.
|
|
583
|
+
"""
|
|
190
584
|
def as_point_set(self) -> ...:
|
|
191
|
-
|
|
585
|
+
"""
|
|
586
|
+
Convert the object to a point set.
|
|
587
|
+
|
|
588
|
+
Returns:
|
|
589
|
+
PointSet: The point set.
|
|
590
|
+
"""
|
|
192
591
|
def as_polygon(self) -> ...:
|
|
193
|
-
|
|
592
|
+
"""
|
|
593
|
+
Convert the object to a polygon.
|
|
594
|
+
|
|
595
|
+
Returns:
|
|
596
|
+
Polygon: The polygon.
|
|
597
|
+
"""
|
|
194
598
|
def as_pyramid(self) -> ...:
|
|
195
|
-
|
|
599
|
+
"""
|
|
600
|
+
Convert the object to a pyramid.
|
|
601
|
+
|
|
602
|
+
Returns:
|
|
603
|
+
Pyramid: The pyramid.
|
|
604
|
+
"""
|
|
196
605
|
def as_ray(self) -> ...:
|
|
197
|
-
|
|
606
|
+
"""
|
|
607
|
+
Convert the object to a ray.
|
|
608
|
+
|
|
609
|
+
Returns:
|
|
610
|
+
Ray: The ray.
|
|
611
|
+
"""
|
|
198
612
|
def as_segment(self) -> ...:
|
|
199
|
-
|
|
613
|
+
"""
|
|
614
|
+
Convert the object to a segment.
|
|
615
|
+
|
|
616
|
+
Returns:
|
|
617
|
+
Segment: The segment.
|
|
618
|
+
"""
|
|
200
619
|
def as_sphere(self) -> ...:
|
|
201
|
-
|
|
620
|
+
"""
|
|
621
|
+
Convert the object to a sphere.
|
|
622
|
+
|
|
623
|
+
Returns:
|
|
624
|
+
Sphere: The sphere.
|
|
625
|
+
"""
|
|
202
626
|
def contains(self, arg0: Object) -> bool:
|
|
203
|
-
|
|
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
|
+
"""
|
|
204
641
|
def intersects(self, arg0: Object) -> bool:
|
|
205
|
-
|
|
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
|
+
"""
|
|
206
663
|
def is_defined(self) -> bool:
|
|
207
|
-
|
|
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
|
+
"""
|
|
208
674
|
def is_ellipsoid(self) -> bool:
|
|
209
|
-
|
|
675
|
+
"""
|
|
676
|
+
Check if the object is an ellipsoid.
|
|
677
|
+
|
|
678
|
+
Returns:
|
|
679
|
+
bool: True if the object is an ellipsoid.
|
|
680
|
+
"""
|
|
210
681
|
def is_line(self) -> bool:
|
|
211
|
-
|
|
682
|
+
"""
|
|
683
|
+
Check if the object is a line.
|
|
684
|
+
|
|
685
|
+
Returns:
|
|
686
|
+
bool: True if the object is a line.
|
|
687
|
+
"""
|
|
212
688
|
def is_line_string(self) -> bool:
|
|
213
|
-
|
|
689
|
+
"""
|
|
690
|
+
Check if the object is a line string.
|
|
691
|
+
|
|
692
|
+
Returns:
|
|
693
|
+
bool: True if the object is a line string.
|
|
694
|
+
"""
|
|
214
695
|
def is_plane(self) -> bool:
|
|
215
|
-
|
|
696
|
+
"""
|
|
697
|
+
Check if the object is a plane.
|
|
698
|
+
|
|
699
|
+
Returns:
|
|
700
|
+
bool: True if the object is a plane.
|
|
701
|
+
"""
|
|
216
702
|
def is_point(self) -> bool:
|
|
217
|
-
|
|
703
|
+
"""
|
|
704
|
+
Check if the object is a point.
|
|
705
|
+
|
|
706
|
+
Returns:
|
|
707
|
+
bool: True if the object is a point.
|
|
708
|
+
"""
|
|
218
709
|
def is_point_set(self) -> bool:
|
|
219
|
-
|
|
710
|
+
"""
|
|
711
|
+
Check if the object is a point set.
|
|
712
|
+
|
|
713
|
+
Returns:
|
|
714
|
+
bool: True if the object is a point set.
|
|
715
|
+
"""
|
|
220
716
|
def is_polygon(self) -> bool:
|
|
221
|
-
|
|
717
|
+
"""
|
|
718
|
+
Check if the object is a polygon.
|
|
719
|
+
|
|
720
|
+
Returns:
|
|
721
|
+
bool: True if the object is a polygon.
|
|
722
|
+
"""
|
|
222
723
|
def is_pyramid(self) -> bool:
|
|
223
|
-
|
|
724
|
+
"""
|
|
725
|
+
Check if the object is a pyramid.
|
|
726
|
+
|
|
727
|
+
Returns:
|
|
728
|
+
bool: True if the object is a pyramid.
|
|
729
|
+
"""
|
|
224
730
|
def is_ray(self) -> bool:
|
|
225
|
-
|
|
731
|
+
"""
|
|
732
|
+
Check if the object is a ray.
|
|
733
|
+
|
|
734
|
+
Returns:
|
|
735
|
+
bool: True if the object is a ray.
|
|
736
|
+
"""
|
|
226
737
|
def is_segment(self) -> bool:
|
|
227
|
-
|
|
738
|
+
"""
|
|
739
|
+
Check if the object is a segment.
|
|
740
|
+
|
|
741
|
+
Returns:
|
|
742
|
+
bool: True if the object is a segment.
|
|
743
|
+
"""
|
|
228
744
|
def is_sphere(self) -> bool:
|
|
229
|
-
|
|
745
|
+
"""
|
|
746
|
+
Check if the object is a sphere.
|
|
747
|
+
|
|
748
|
+
Returns:
|
|
749
|
+
bool: True if the object is a sphere.
|
|
750
|
+
"""
|
|
230
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
|
+
"""
|
|
231
759
|
class Type:
|
|
232
760
|
"""
|
|
233
761
|
Members:
|
|
@@ -286,34 +814,140 @@ class Transformation:
|
|
|
286
814
|
__hash__: typing.ClassVar[None] = None
|
|
287
815
|
@staticmethod
|
|
288
816
|
def identity() -> Transformation:
|
|
289
|
-
|
|
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
|
+
"""
|
|
290
827
|
@staticmethod
|
|
291
828
|
@typing.overload
|
|
292
829
|
def rotation(rotation_vector: typing.Any) -> Transformation:
|
|
293
|
-
|
|
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
|
+
"""
|
|
294
844
|
@staticmethod
|
|
295
845
|
@typing.overload
|
|
296
846
|
def rotation(rotation_matrix: typing.Any) -> Transformation:
|
|
297
|
-
|
|
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
|
+
"""
|
|
298
861
|
@staticmethod
|
|
299
862
|
def rotation_around(point: object.Point, rotation_vector: typing.Any) -> Transformation:
|
|
300
|
-
|
|
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
|
+
"""
|
|
301
879
|
@staticmethod
|
|
302
880
|
def string_from_type(type: typing.Any) -> ostk.core.type.String:
|
|
303
|
-
|
|
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
|
+
"""
|
|
304
894
|
@staticmethod
|
|
305
895
|
def translation(translation_vector: numpy.ndarray[numpy.float64[3, 1]]) -> Transformation:
|
|
306
|
-
|
|
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
|
+
"""
|
|
307
910
|
@staticmethod
|
|
308
911
|
def type_of_matrix(matrix: numpy.ndarray[numpy.float64[4, 4]]) -> ...:
|
|
309
|
-
|
|
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
|
+
"""
|
|
310
925
|
@staticmethod
|
|
311
926
|
def undefined() -> Transformation:
|
|
312
|
-
|
|
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
|
+
"""
|
|
313
937
|
def __eq__(self, arg0: Transformation) -> bool:
|
|
314
938
|
...
|
|
315
939
|
def __init__(self, matrix: numpy.ndarray[numpy.float64[4, 4]]) -> None:
|
|
316
|
-
|
|
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
|
+
"""
|
|
317
951
|
def __ne__(self, arg0: Transformation) -> bool:
|
|
318
952
|
...
|
|
319
953
|
def __repr__(self) -> str:
|
|
@@ -322,15 +956,77 @@ class Transformation:
|
|
|
322
956
|
...
|
|
323
957
|
@typing.overload
|
|
324
958
|
def apply_to(self, point: object.Point) -> object.Point:
|
|
325
|
-
|
|
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
|
+
"""
|
|
326
973
|
@typing.overload
|
|
327
974
|
def apply_to(self, vector: numpy.ndarray[numpy.float64[3, 1]]) -> numpy.ndarray[numpy.float64[3, 1]]:
|
|
328
|
-
|
|
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
|
+
"""
|
|
329
989
|
def get_inverse(self) -> Transformation:
|
|
330
|
-
|
|
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
|
+
"""
|
|
331
1000
|
def get_matrix(self) -> numpy.ndarray[numpy.float64[4, 4]]:
|
|
332
|
-
|
|
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
|
+
"""
|
|
333
1011
|
def get_type(self) -> ...:
|
|
334
|
-
|
|
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
|
+
"""
|
|
335
1022
|
def is_defined(self) -> bool:
|
|
336
|
-
|
|
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
|
+
"""
|