open-space-toolkit-mathematics 4.5.2__py313-none-manylinux2014_aarch64.whl → 4.5.4__py313-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-313-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
|
@@ -66,25 +66,102 @@ class Intersection:
|
|
|
66
66
|
__hash__: typing.ClassVar[None] = None
|
|
67
67
|
@staticmethod
|
|
68
68
|
def empty() -> Intersection:
|
|
69
|
-
|
|
69
|
+
"""
|
|
70
|
+
Create an empty intersection.
|
|
71
|
+
|
|
72
|
+
Returns:
|
|
73
|
+
Intersection: An empty intersection containing no geometry.
|
|
74
|
+
|
|
75
|
+
Example:
|
|
76
|
+
>>> empty_intersection = Intersection.empty()
|
|
77
|
+
>>> empty_intersection.is_empty() # True
|
|
78
|
+
"""
|
|
70
79
|
@staticmethod
|
|
71
80
|
def line(line: object.Line) -> Intersection:
|
|
72
|
-
|
|
81
|
+
"""
|
|
82
|
+
Create an intersection containing a line.
|
|
83
|
+
|
|
84
|
+
Args:
|
|
85
|
+
line (Line): The line to include in the intersection.
|
|
86
|
+
|
|
87
|
+
Returns:
|
|
88
|
+
Intersection: An intersection containing the line.
|
|
89
|
+
|
|
90
|
+
Example:
|
|
91
|
+
>>> line = Line(Point(0.0, 0.0), np.array([1.0, 1.0]))
|
|
92
|
+
>>> intersection = Intersection.line(line)
|
|
93
|
+
"""
|
|
73
94
|
@staticmethod
|
|
74
95
|
def point(point: object.Point) -> Intersection:
|
|
75
|
-
|
|
96
|
+
"""
|
|
97
|
+
Create an intersection containing a single point.
|
|
98
|
+
|
|
99
|
+
Args:
|
|
100
|
+
point (Point): The point to include in the intersection.
|
|
101
|
+
|
|
102
|
+
Returns:
|
|
103
|
+
Intersection: An intersection containing the point.
|
|
104
|
+
|
|
105
|
+
Example:
|
|
106
|
+
>>> point = Point(1.0, 2.0)
|
|
107
|
+
>>> intersection = Intersection.point(point)
|
|
108
|
+
"""
|
|
76
109
|
@staticmethod
|
|
77
110
|
def point_set(point_set: object.PointSet) -> Intersection:
|
|
78
|
-
|
|
111
|
+
"""
|
|
112
|
+
Create an intersection containing a point set.
|
|
113
|
+
|
|
114
|
+
Args:
|
|
115
|
+
point_set (PointSet): The point set to include in the intersection.
|
|
116
|
+
|
|
117
|
+
Returns:
|
|
118
|
+
Intersection: An intersection containing the point set.
|
|
119
|
+
|
|
120
|
+
Example:
|
|
121
|
+
>>> points = PointSet([Point(1.0, 2.0), Point(3.0, 4.0)])
|
|
122
|
+
>>> intersection = Intersection.point_set(points)
|
|
123
|
+
"""
|
|
79
124
|
@staticmethod
|
|
80
125
|
def segment(segment: object.Segment) -> Intersection:
|
|
81
|
-
|
|
126
|
+
"""
|
|
127
|
+
Create an intersection containing a segment.
|
|
128
|
+
|
|
129
|
+
Args:
|
|
130
|
+
segment (Segment): The segment to include in the intersection.
|
|
131
|
+
|
|
132
|
+
Returns:
|
|
133
|
+
Intersection: An intersection containing the segment.
|
|
134
|
+
|
|
135
|
+
Example:
|
|
136
|
+
>>> segment = Segment(Point(0.0, 0.0), Point(1.0, 1.0))
|
|
137
|
+
>>> intersection = Intersection.segment(segment)
|
|
138
|
+
"""
|
|
82
139
|
@staticmethod
|
|
83
|
-
def string_from_type(
|
|
84
|
-
|
|
140
|
+
def string_from_type(type: typing.Any) -> ostk.core.type.String:
|
|
141
|
+
"""
|
|
142
|
+
Get the string representation of an intersection type.
|
|
143
|
+
|
|
144
|
+
Args:
|
|
145
|
+
type (Intersection.Type): The intersection type.
|
|
146
|
+
|
|
147
|
+
Returns:
|
|
148
|
+
str: String representation of the type.
|
|
149
|
+
|
|
150
|
+
Example:
|
|
151
|
+
>>> Intersection.string_from_type(Intersection.Type.Point) # "Point"
|
|
152
|
+
"""
|
|
85
153
|
@staticmethod
|
|
86
154
|
def undefined() -> Intersection:
|
|
87
|
-
|
|
155
|
+
"""
|
|
156
|
+
Create an undefined intersection.
|
|
157
|
+
|
|
158
|
+
Returns:
|
|
159
|
+
Intersection: An undefined intersection.
|
|
160
|
+
|
|
161
|
+
Example:
|
|
162
|
+
>>> undefined_intersection = Intersection.undefined()
|
|
163
|
+
>>> undefined_intersection.is_defined() # False
|
|
164
|
+
"""
|
|
88
165
|
def __add__(self, arg0: Intersection) -> Intersection:
|
|
89
166
|
...
|
|
90
167
|
def __eq__(self, arg0: Intersection) -> bool:
|
|
@@ -98,43 +175,251 @@ class Intersection:
|
|
|
98
175
|
def __str__(self) -> str:
|
|
99
176
|
...
|
|
100
177
|
def access_composite(self) -> object.Composite:
|
|
101
|
-
|
|
178
|
+
"""
|
|
179
|
+
Access the composite representation of the intersection.
|
|
180
|
+
|
|
181
|
+
Returns:
|
|
182
|
+
Composite: Reference to the composite containing all intersection objects.
|
|
183
|
+
|
|
184
|
+
Example:
|
|
185
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0))
|
|
186
|
+
>>> composite = intersection.access_composite()
|
|
187
|
+
"""
|
|
102
188
|
def as_composite(self) -> object.Composite:
|
|
103
|
-
|
|
189
|
+
"""
|
|
190
|
+
Convert the intersection to a Composite.
|
|
191
|
+
|
|
192
|
+
Returns:
|
|
193
|
+
Composite: The composite contained in the intersection.
|
|
194
|
+
|
|
195
|
+
Raises:
|
|
196
|
+
RuntimeError: If the intersection does not contain a Composite.
|
|
197
|
+
|
|
198
|
+
Example:
|
|
199
|
+
>>> composite = Composite(Point(1.0, 2.0))
|
|
200
|
+
>>> # intersection = Intersection.composite(composite)
|
|
201
|
+
>>> # extracted_composite = intersection.as_composite()
|
|
202
|
+
"""
|
|
104
203
|
def as_line(self) -> object.Line:
|
|
105
|
-
|
|
204
|
+
"""
|
|
205
|
+
Convert the intersection to a Line.
|
|
206
|
+
|
|
207
|
+
Returns:
|
|
208
|
+
Line: The line contained in the intersection.
|
|
209
|
+
|
|
210
|
+
Raises:
|
|
211
|
+
RuntimeError: If the intersection does not contain a Line.
|
|
212
|
+
|
|
213
|
+
Example:
|
|
214
|
+
>>> line = Line(Point(0.0, 0.0), np.array([1.0, 1.0]))
|
|
215
|
+
>>> intersection = Intersection.line(line)
|
|
216
|
+
>>> extracted_line = intersection.as_line()
|
|
217
|
+
"""
|
|
106
218
|
def as_line_string(self) -> object.LineString:
|
|
107
|
-
|
|
219
|
+
"""
|
|
220
|
+
Convert the intersection to a LineString.
|
|
221
|
+
|
|
222
|
+
Returns:
|
|
223
|
+
LineString: The line string contained in the intersection.
|
|
224
|
+
|
|
225
|
+
Raises:
|
|
226
|
+
RuntimeError: If the intersection does not contain a LineString.
|
|
227
|
+
|
|
228
|
+
Example:
|
|
229
|
+
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0), Point(2.0, 2.0)]
|
|
230
|
+
>>> line_string = LineString(points)
|
|
231
|
+
>>> # intersection = Intersection.line_string(line_string)
|
|
232
|
+
>>> # extracted_line_string = intersection.as_line_string()
|
|
233
|
+
"""
|
|
108
234
|
def as_point(self) -> object.Point:
|
|
109
|
-
|
|
235
|
+
"""
|
|
236
|
+
Convert the intersection to a Point.
|
|
237
|
+
|
|
238
|
+
Returns:
|
|
239
|
+
Point: The point contained in the intersection.
|
|
240
|
+
|
|
241
|
+
Raises:
|
|
242
|
+
RuntimeError: If the intersection does not contain a Point.
|
|
243
|
+
|
|
244
|
+
Example:
|
|
245
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0))
|
|
246
|
+
>>> point = intersection.as_point()
|
|
247
|
+
"""
|
|
110
248
|
def as_point_set(self) -> object.PointSet:
|
|
111
|
-
|
|
249
|
+
"""
|
|
250
|
+
Convert the intersection to a PointSet.
|
|
251
|
+
|
|
252
|
+
Returns:
|
|
253
|
+
PointSet: The point set contained in the intersection.
|
|
254
|
+
|
|
255
|
+
Raises:
|
|
256
|
+
RuntimeError: If the intersection does not contain a PointSet.
|
|
257
|
+
|
|
258
|
+
Example:
|
|
259
|
+
>>> points = PointSet([Point(1.0, 2.0), Point(3.0, 4.0)])
|
|
260
|
+
>>> intersection = Intersection.point_set(points)
|
|
261
|
+
>>> point_set = intersection.as_point_set()
|
|
262
|
+
"""
|
|
112
263
|
def as_polygon(self) -> object.Polygon:
|
|
113
|
-
|
|
264
|
+
"""
|
|
265
|
+
Convert the intersection to a Polygon.
|
|
266
|
+
|
|
267
|
+
Returns:
|
|
268
|
+
Polygon: The polygon contained in the intersection.
|
|
269
|
+
|
|
270
|
+
Raises:
|
|
271
|
+
RuntimeError: If the intersection does not contain a Polygon.
|
|
272
|
+
|
|
273
|
+
Example:
|
|
274
|
+
>>> vertices = [Point(0.0, 0.0), Point(1.0, 0.0), Point(1.0, 1.0)]
|
|
275
|
+
>>> polygon = Polygon(vertices)
|
|
276
|
+
>>> # intersection = Intersection.polygon(polygon)
|
|
277
|
+
>>> # extracted_polygon = intersection.as_polygon()
|
|
278
|
+
"""
|
|
114
279
|
def as_segment(self) -> object.Segment:
|
|
115
|
-
|
|
280
|
+
"""
|
|
281
|
+
Convert the intersection to a Segment.
|
|
282
|
+
|
|
283
|
+
Returns:
|
|
284
|
+
Segment: The segment contained in the intersection.
|
|
285
|
+
|
|
286
|
+
Raises:
|
|
287
|
+
RuntimeError: If the intersection does not contain a Segment.
|
|
288
|
+
|
|
289
|
+
Example:
|
|
290
|
+
>>> segment = Segment(Point(0.0, 0.0), Point(1.0, 1.0))
|
|
291
|
+
>>> intersection = Intersection.segment(segment)
|
|
292
|
+
>>> extracted_segment = intersection.as_segment()
|
|
293
|
+
"""
|
|
116
294
|
def get_type(self) -> ...:
|
|
117
|
-
|
|
295
|
+
"""
|
|
296
|
+
Get the type of the intersection.
|
|
297
|
+
|
|
298
|
+
Returns:
|
|
299
|
+
Intersection.Type: The type of geometry contained in the intersection.
|
|
300
|
+
|
|
301
|
+
Example:
|
|
302
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0))
|
|
303
|
+
>>> intersection.get_type() # Intersection.Type.Point
|
|
304
|
+
"""
|
|
118
305
|
def is_complex(self) -> bool:
|
|
119
|
-
|
|
306
|
+
"""
|
|
307
|
+
Check if the intersection is complex (contains multiple different types).
|
|
308
|
+
|
|
309
|
+
Returns:
|
|
310
|
+
bool: True if the intersection is complex, False otherwise.
|
|
311
|
+
|
|
312
|
+
Example:
|
|
313
|
+
>>> # Complex intersections contain multiple geometric types
|
|
314
|
+
>>> intersection.is_complex()
|
|
315
|
+
"""
|
|
120
316
|
def is_composite(self) -> bool:
|
|
121
|
-
|
|
317
|
+
"""
|
|
318
|
+
Check if the intersection contains a Composite.
|
|
319
|
+
|
|
320
|
+
Returns:
|
|
321
|
+
bool: True if the intersection contains a Composite, False otherwise.
|
|
322
|
+
|
|
323
|
+
Example:
|
|
324
|
+
>>> composite = Composite(Point(1.0, 2.0))
|
|
325
|
+
>>> # intersection = Intersection.composite(composite)
|
|
326
|
+
>>> # intersection.is_composite() # True
|
|
327
|
+
"""
|
|
122
328
|
def is_defined(self) -> bool:
|
|
123
|
-
|
|
329
|
+
"""
|
|
330
|
+
Check if the intersection is defined.
|
|
331
|
+
|
|
332
|
+
Returns:
|
|
333
|
+
bool: True if the intersection is defined, False otherwise.
|
|
334
|
+
|
|
335
|
+
Example:
|
|
336
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0))
|
|
337
|
+
>>> intersection.is_defined() # True
|
|
338
|
+
"""
|
|
124
339
|
def is_empty(self) -> bool:
|
|
125
|
-
|
|
340
|
+
"""
|
|
341
|
+
Check if the intersection is empty (no geometric objects).
|
|
342
|
+
|
|
343
|
+
Returns:
|
|
344
|
+
bool: True if the intersection is empty, False otherwise.
|
|
345
|
+
|
|
346
|
+
Example:
|
|
347
|
+
>>> empty_intersection = Intersection.empty()
|
|
348
|
+
>>> empty_intersection.is_empty() # True
|
|
349
|
+
"""
|
|
126
350
|
def is_line(self) -> bool:
|
|
127
|
-
|
|
351
|
+
"""
|
|
352
|
+
Check if the intersection contains a Line.
|
|
353
|
+
|
|
354
|
+
Returns:
|
|
355
|
+
bool: True if the intersection contains a Line, False otherwise.
|
|
356
|
+
|
|
357
|
+
Example:
|
|
358
|
+
>>> line = Line(Point(0.0, 0.0), np.array([1.0, 1.0]))
|
|
359
|
+
>>> intersection = Intersection.line(line)
|
|
360
|
+
>>> intersection.is_line() # True
|
|
361
|
+
"""
|
|
128
362
|
def is_line_string(self) -> bool:
|
|
129
|
-
|
|
363
|
+
"""
|
|
364
|
+
Check if the intersection contains a LineString.
|
|
365
|
+
|
|
366
|
+
Returns:
|
|
367
|
+
bool: True if the intersection contains a LineString, False otherwise.
|
|
368
|
+
|
|
369
|
+
Example:
|
|
370
|
+
>>> points = [Point(0.0, 0.0), Point(1.0, 1.0), Point(2.0, 2.0)]
|
|
371
|
+
>>> line_string = LineString(points)
|
|
372
|
+
>>> # intersection = Intersection.line_string(line_string)
|
|
373
|
+
>>> # intersection.is_line_string() # True
|
|
374
|
+
"""
|
|
130
375
|
def is_point(self) -> bool:
|
|
131
|
-
|
|
376
|
+
"""
|
|
377
|
+
Check if the intersection contains a Point.
|
|
378
|
+
|
|
379
|
+
Returns:
|
|
380
|
+
bool: True if the intersection contains a Point, False otherwise.
|
|
381
|
+
|
|
382
|
+
Example:
|
|
383
|
+
>>> intersection = Intersection.point(Point(1.0, 2.0))
|
|
384
|
+
>>> intersection.is_point() # True
|
|
385
|
+
"""
|
|
132
386
|
def is_point_set(self) -> bool:
|
|
133
|
-
|
|
387
|
+
"""
|
|
388
|
+
Check if the intersection contains a PointSet.
|
|
389
|
+
|
|
390
|
+
Returns:
|
|
391
|
+
bool: True if the intersection contains a PointSet, False otherwise.
|
|
392
|
+
|
|
393
|
+
Example:
|
|
394
|
+
>>> points = PointSet([Point(1.0, 2.0), Point(3.0, 4.0)])
|
|
395
|
+
>>> intersection = Intersection.point_set(points)
|
|
396
|
+
>>> intersection.is_point_set() # True
|
|
397
|
+
"""
|
|
134
398
|
def is_polygon(self) -> bool:
|
|
135
|
-
|
|
399
|
+
"""
|
|
400
|
+
Check if the intersection contains a Polygon.
|
|
401
|
+
|
|
402
|
+
Returns:
|
|
403
|
+
bool: True if the intersection contains a Polygon, False otherwise.
|
|
404
|
+
|
|
405
|
+
Example:
|
|
406
|
+
>>> vertices = [Point(0.0, 0.0), Point(1.0, 0.0), Point(1.0, 1.0)]
|
|
407
|
+
>>> polygon = Polygon(vertices)
|
|
408
|
+
>>> # intersection = Intersection.polygon(polygon)
|
|
409
|
+
>>> # intersection.is_polygon() # True
|
|
410
|
+
"""
|
|
136
411
|
def is_segment(self) -> bool:
|
|
137
|
-
|
|
412
|
+
"""
|
|
413
|
+
Check if the intersection contains a Segment.
|
|
414
|
+
|
|
415
|
+
Returns:
|
|
416
|
+
bool: True if the intersection contains a Segment, False otherwise.
|
|
417
|
+
|
|
418
|
+
Example:
|
|
419
|
+
>>> segment = Segment(Point(0.0, 0.0), Point(1.0, 1.0))
|
|
420
|
+
>>> intersection = Intersection.segment(segment)
|
|
421
|
+
>>> intersection.is_segment() # True
|
|
422
|
+
"""
|
|
138
423
|
class Object:
|
|
139
424
|
class Format:
|
|
140
425
|
"""
|
|
@@ -178,21 +463,92 @@ class Object:
|
|
|
178
463
|
...
|
|
179
464
|
__hash__: typing.ClassVar[None] = None
|
|
180
465
|
def __eq__(self, arg0: Object) -> bool:
|
|
181
|
-
|
|
466
|
+
"""
|
|
467
|
+
Check if two 2D objects are equal.
|
|
468
|
+
|
|
469
|
+
Args:
|
|
470
|
+
other (Object): The object to compare with.
|
|
471
|
+
|
|
472
|
+
Returns:
|
|
473
|
+
bool: True if objects are equal, False otherwise.
|
|
474
|
+
|
|
475
|
+
Example:
|
|
476
|
+
>>> point1 = Point(1.0, 2.0)
|
|
477
|
+
>>> point2 = Point(1.0, 2.0)
|
|
478
|
+
>>> point1 == point2 # True
|
|
479
|
+
"""
|
|
182
480
|
def __ne__(self, arg0: Object) -> bool:
|
|
183
|
-
|
|
481
|
+
"""
|
|
482
|
+
Check if two 2D objects are not equal.
|
|
483
|
+
|
|
484
|
+
Args:
|
|
485
|
+
other (Object): The object to compare with.
|
|
486
|
+
|
|
487
|
+
Returns:
|
|
488
|
+
bool: True if objects are not equal, False otherwise.
|
|
489
|
+
|
|
490
|
+
Example:
|
|
491
|
+
>>> point1 = Point(1.0, 2.0)
|
|
492
|
+
>>> point2 = Point(3.0, 4.0)
|
|
493
|
+
>>> point1 != point2 # True
|
|
494
|
+
"""
|
|
184
495
|
def __repr__(self) -> str:
|
|
185
496
|
...
|
|
186
497
|
def __str__(self) -> str:
|
|
187
498
|
...
|
|
188
499
|
def apply_transformation(self, transformation: typing.Any) -> None:
|
|
189
|
-
|
|
500
|
+
"""
|
|
501
|
+
Apply a transformation to the 2D object in place.
|
|
502
|
+
|
|
503
|
+
Args:
|
|
504
|
+
transformation (Transformation): The 2D transformation to apply.
|
|
505
|
+
|
|
506
|
+
Example:
|
|
507
|
+
>>> point = Point(1.0, 2.0)
|
|
508
|
+
>>> transformation = Translation([1.0, 1.0])
|
|
509
|
+
>>> point.apply_transformation(transformation)
|
|
510
|
+
"""
|
|
190
511
|
def contains(self, object: Object) -> bool:
|
|
191
|
-
|
|
512
|
+
"""
|
|
513
|
+
Check if this 2D object contains another object.
|
|
514
|
+
|
|
515
|
+
Args:
|
|
516
|
+
object (Object): The object to check containment for.
|
|
517
|
+
|
|
518
|
+
Returns:
|
|
519
|
+
bool: True if this object contains the other, False otherwise.
|
|
520
|
+
|
|
521
|
+
Example:
|
|
522
|
+
>>> polygon = Polygon([Point(0.0, 0.0), Point(2.0, 0.0), Point(2.0, 2.0)])
|
|
523
|
+
>>> point = Point(1.0, 1.0)
|
|
524
|
+
>>> polygon.contains(point) # True
|
|
525
|
+
"""
|
|
192
526
|
def intersects(self, object: Object) -> bool:
|
|
193
|
-
|
|
527
|
+
"""
|
|
528
|
+
Check if this 2D object intersects with another object.
|
|
529
|
+
|
|
530
|
+
Args:
|
|
531
|
+
object (Object): The object to check intersection with.
|
|
532
|
+
|
|
533
|
+
Returns:
|
|
534
|
+
bool: True if objects intersect, False otherwise.
|
|
535
|
+
|
|
536
|
+
Example:
|
|
537
|
+
>>> line1 = Line(Point(0.0, 0.0), np.array([1.0, 0.0]))
|
|
538
|
+
>>> line2 = Line(Point(0.0, -1.0), np.array([0.0, 1.0]))
|
|
539
|
+
>>> line1.intersects(line2) # True
|
|
540
|
+
"""
|
|
194
541
|
def is_defined(self) -> bool:
|
|
195
|
-
|
|
542
|
+
"""
|
|
543
|
+
Check if the 2D object is defined.
|
|
544
|
+
|
|
545
|
+
Returns:
|
|
546
|
+
bool: True if the object is defined, False otherwise.
|
|
547
|
+
|
|
548
|
+
Example:
|
|
549
|
+
>>> point = Point(1.0, 2.0)
|
|
550
|
+
>>> point.is_defined() # True
|
|
551
|
+
"""
|
|
196
552
|
class Transformation:
|
|
197
553
|
class Type:
|
|
198
554
|
"""
|
|
@@ -252,29 +608,123 @@ class Transformation:
|
|
|
252
608
|
__hash__: typing.ClassVar[None] = None
|
|
253
609
|
@staticmethod
|
|
254
610
|
def identity() -> Transformation:
|
|
255
|
-
|
|
611
|
+
"""
|
|
612
|
+
Create an identity transformation (no change).
|
|
613
|
+
|
|
614
|
+
Returns:
|
|
615
|
+
Transformation: The identity transformation.
|
|
616
|
+
|
|
617
|
+
Example:
|
|
618
|
+
>>> identity = Transformation.identity()
|
|
619
|
+
>>> point = Point(1.0, 2.0)
|
|
620
|
+
>>> identity.apply_to(point) # Point(1.0, 2.0) - unchanged
|
|
621
|
+
"""
|
|
256
622
|
@staticmethod
|
|
257
623
|
def rotation(rotation_angle: typing.Any) -> Transformation:
|
|
258
|
-
|
|
624
|
+
"""
|
|
625
|
+
Create a rotation transformation around the origin.
|
|
626
|
+
|
|
627
|
+
Args:
|
|
628
|
+
rotation_angle (Angle): The rotation angle.
|
|
629
|
+
|
|
630
|
+
Returns:
|
|
631
|
+
Transformation: The rotation transformation.
|
|
632
|
+
|
|
633
|
+
Example:
|
|
634
|
+
>>> rotation = Transformation.rotation(Angle.degrees(90.0))
|
|
635
|
+
>>> point = Point(1.0, 0.0)
|
|
636
|
+
>>> rotation.apply_to(point) # Point(0.0, 1.0)
|
|
637
|
+
"""
|
|
259
638
|
@staticmethod
|
|
260
639
|
def rotation_around(point: object.Point, rotation_angle: typing.Any) -> Transformation:
|
|
261
|
-
|
|
640
|
+
"""
|
|
641
|
+
Create a rotation transformation around a specific point.
|
|
642
|
+
|
|
643
|
+
Args:
|
|
644
|
+
point (Point): The center point of rotation.
|
|
645
|
+
rotation_angle (Angle): The rotation angle.
|
|
646
|
+
|
|
647
|
+
Returns:
|
|
648
|
+
Transformation: The rotation transformation around the specified point.
|
|
649
|
+
|
|
650
|
+
Example:
|
|
651
|
+
>>> center = Point(1.0, 1.0)
|
|
652
|
+
>>> rotation = Transformation.rotation_around(center, Angle.degrees(90.0))
|
|
653
|
+
>>> point = Point(2.0, 1.0)
|
|
654
|
+
>>> rotation.apply_to(point) # Point(1.0, 2.0)
|
|
655
|
+
"""
|
|
262
656
|
@staticmethod
|
|
263
657
|
def string_from_type(type: typing.Any) -> ostk.core.type.String:
|
|
264
|
-
|
|
658
|
+
"""
|
|
659
|
+
Get the string representation of a transformation type.
|
|
660
|
+
|
|
661
|
+
Args:
|
|
662
|
+
type (Transformation.Type): The transformation type.
|
|
663
|
+
|
|
664
|
+
Returns:
|
|
665
|
+
str: String representation of the type.
|
|
666
|
+
|
|
667
|
+
Example:
|
|
668
|
+
>>> Transformation.string_from_type(Transformation.Type.Translation) # "Translation"
|
|
669
|
+
"""
|
|
265
670
|
@staticmethod
|
|
266
|
-
def translation(
|
|
267
|
-
|
|
671
|
+
def translation(translation_vector: numpy.ndarray[numpy.float64[2, 1]]) -> Transformation:
|
|
672
|
+
"""
|
|
673
|
+
Create a translation transformation.
|
|
674
|
+
|
|
675
|
+
Args:
|
|
676
|
+
translation_vector (Vector2d): The translation vector.
|
|
677
|
+
|
|
678
|
+
Returns:
|
|
679
|
+
Transformation: The translation transformation.
|
|
680
|
+
|
|
681
|
+
Example:
|
|
682
|
+
>>> translation = Transformation.translation([1.0, 2.0])
|
|
683
|
+
>>> point = Point(0.0, 0.0)
|
|
684
|
+
>>> translation.apply_to(point) # Point(1.0, 2.0)
|
|
685
|
+
"""
|
|
268
686
|
@staticmethod
|
|
269
687
|
def type_of_matrix(matrix: numpy.ndarray[numpy.float64[3, 3]]) -> ...:
|
|
270
|
-
|
|
688
|
+
"""
|
|
689
|
+
Determine the transformation type from a matrix.
|
|
690
|
+
|
|
691
|
+
Args:
|
|
692
|
+
matrix (Matrix3d): The transformation matrix to analyze.
|
|
693
|
+
|
|
694
|
+
Returns:
|
|
695
|
+
Transformation.Type: The detected transformation type.
|
|
696
|
+
|
|
697
|
+
Example:
|
|
698
|
+
>>> import numpy as np
|
|
699
|
+
>>> matrix = np.eye(3)
|
|
700
|
+
>>> Transformation.type_of_matrix(matrix) # Transformation.Type.Identity
|
|
701
|
+
"""
|
|
271
702
|
@staticmethod
|
|
272
703
|
def undefined() -> Transformation:
|
|
273
|
-
|
|
704
|
+
"""
|
|
705
|
+
Create an undefined transformation.
|
|
706
|
+
|
|
707
|
+
Returns:
|
|
708
|
+
Transformation: An undefined transformation.
|
|
709
|
+
|
|
710
|
+
Example:
|
|
711
|
+
>>> undefined_transform = Transformation.undefined()
|
|
712
|
+
>>> undefined_transform.is_defined() # False
|
|
713
|
+
"""
|
|
274
714
|
def __eq__(self, arg0: Transformation) -> bool:
|
|
275
715
|
...
|
|
276
716
|
def __init__(self, matrix: numpy.ndarray[numpy.float64[3, 3]]) -> None:
|
|
277
|
-
|
|
717
|
+
"""
|
|
718
|
+
Create a 2D transformation from a 3x3 transformation matrix.
|
|
719
|
+
|
|
720
|
+
Args:
|
|
721
|
+
matrix (Matrix3d): The 3x3 transformation matrix in homogeneous coordinates.
|
|
722
|
+
|
|
723
|
+
Example:
|
|
724
|
+
>>> import numpy as np
|
|
725
|
+
>>> matrix = np.eye(3) # Identity matrix
|
|
726
|
+
>>> transformation = Transformation(matrix)
|
|
727
|
+
"""
|
|
278
728
|
def __ne__(self, arg0: Transformation) -> bool:
|
|
279
729
|
...
|
|
280
730
|
def __repr__(self) -> str:
|
|
@@ -283,15 +733,77 @@ class Transformation:
|
|
|
283
733
|
...
|
|
284
734
|
@typing.overload
|
|
285
735
|
def apply_to(self, point: object.Point) -> object.Point:
|
|
286
|
-
|
|
736
|
+
"""
|
|
737
|
+
Apply the transformation to a point.
|
|
738
|
+
|
|
739
|
+
Args:
|
|
740
|
+
point (Point): The point to transform.
|
|
741
|
+
|
|
742
|
+
Returns:
|
|
743
|
+
Point: The transformed point.
|
|
744
|
+
|
|
745
|
+
Example:
|
|
746
|
+
>>> point = Point(1.0, 2.0)
|
|
747
|
+
>>> translation = Transformation.translation([1.0, 1.0])
|
|
748
|
+
>>> transformed = translation.apply_to(point) # Point(2.0, 3.0)
|
|
749
|
+
"""
|
|
287
750
|
@typing.overload
|
|
288
751
|
def apply_to(self, vector: numpy.ndarray[numpy.float64[2, 1]]) -> numpy.ndarray[numpy.float64[2, 1]]:
|
|
289
|
-
|
|
752
|
+
"""
|
|
753
|
+
Apply the transformation to a vector.
|
|
754
|
+
|
|
755
|
+
Args:
|
|
756
|
+
vector (Vector2d): The vector to transform.
|
|
757
|
+
|
|
758
|
+
Returns:
|
|
759
|
+
Vector2d: The transformed vector.
|
|
760
|
+
|
|
761
|
+
Example:
|
|
762
|
+
>>> vector = np.array([1.0, 0.0])
|
|
763
|
+
>>> rotation = Transformation.rotation(Angle.degrees(90.0))
|
|
764
|
+
>>> transformed = rotation.apply_to(vector) # [0.0, 1.0]
|
|
765
|
+
"""
|
|
290
766
|
def get_inverse(self) -> Transformation:
|
|
291
|
-
|
|
767
|
+
"""
|
|
768
|
+
Get the inverse transformation.
|
|
769
|
+
|
|
770
|
+
Returns:
|
|
771
|
+
Transformation: The inverse transformation.
|
|
772
|
+
|
|
773
|
+
Example:
|
|
774
|
+
>>> translation = Transformation.translation([1.0, 2.0])
|
|
775
|
+
>>> inverse = translation.get_inverse() # Translation by [-1.0, -2.0]
|
|
776
|
+
"""
|
|
292
777
|
def get_matrix(self) -> numpy.ndarray[numpy.float64[3, 3]]:
|
|
293
|
-
|
|
778
|
+
"""
|
|
779
|
+
Get the transformation matrix.
|
|
780
|
+
|
|
781
|
+
Returns:
|
|
782
|
+
Matrix3d: The 3x3 transformation matrix in homogeneous coordinates.
|
|
783
|
+
|
|
784
|
+
Example:
|
|
785
|
+
>>> transformation = Transformation.identity()
|
|
786
|
+
>>> matrix = transformation.get_matrix() # 3x3 identity matrix
|
|
787
|
+
"""
|
|
294
788
|
def get_type(self) -> ...:
|
|
295
|
-
|
|
789
|
+
"""
|
|
790
|
+
Get the type of the transformation.
|
|
791
|
+
|
|
792
|
+
Returns:
|
|
793
|
+
Transformation.Type: The transformation type (Identity, Translation, Rotation, etc.).
|
|
794
|
+
|
|
795
|
+
Example:
|
|
796
|
+
>>> transformation = Transformation.identity()
|
|
797
|
+
>>> transformation.get_type() # Transformation.Type.Identity
|
|
798
|
+
"""
|
|
296
799
|
def is_defined(self) -> bool:
|
|
297
|
-
|
|
800
|
+
"""
|
|
801
|
+
Check if the transformation is defined.
|
|
802
|
+
|
|
803
|
+
Returns:
|
|
804
|
+
bool: True if the transformation is defined, False otherwise.
|
|
805
|
+
|
|
806
|
+
Example:
|
|
807
|
+
>>> transformation = Transformation.identity()
|
|
808
|
+
>>> transformation.is_defined() # True
|
|
809
|
+
"""
|