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,809 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import numpy
|
|
3
|
+
import ostk.core.type
|
|
4
|
+
import typing
|
|
5
|
+
from . import object
|
|
6
|
+
__all__ = ['Intersection', 'Object', 'Transformation', 'object']
|
|
7
|
+
class Intersection:
|
|
8
|
+
class Type:
|
|
9
|
+
"""
|
|
10
|
+
Members:
|
|
11
|
+
|
|
12
|
+
Undefined
|
|
13
|
+
|
|
14
|
+
Empty
|
|
15
|
+
|
|
16
|
+
Point
|
|
17
|
+
|
|
18
|
+
PointSet
|
|
19
|
+
|
|
20
|
+
Line
|
|
21
|
+
|
|
22
|
+
LineString
|
|
23
|
+
|
|
24
|
+
Segment
|
|
25
|
+
|
|
26
|
+
Polygon
|
|
27
|
+
|
|
28
|
+
Complex
|
|
29
|
+
"""
|
|
30
|
+
Complex: typing.ClassVar[Intersection.Type] # value = <Type.Complex: 8>
|
|
31
|
+
Empty: typing.ClassVar[Intersection.Type] # value = <Type.Empty: 1>
|
|
32
|
+
Line: typing.ClassVar[Intersection.Type] # value = <Type.Line: 4>
|
|
33
|
+
LineString: typing.ClassVar[Intersection.Type] # value = <Type.LineString: 6>
|
|
34
|
+
Point: typing.ClassVar[Intersection.Type] # value = <Type.Point: 2>
|
|
35
|
+
PointSet: typing.ClassVar[Intersection.Type] # value = <Type.PointSet: 3>
|
|
36
|
+
Polygon: typing.ClassVar[Intersection.Type] # value = <Type.Polygon: 7>
|
|
37
|
+
Segment: typing.ClassVar[Intersection.Type] # value = <Type.Segment: 5>
|
|
38
|
+
Undefined: typing.ClassVar[Intersection.Type] # value = <Type.Undefined: 0>
|
|
39
|
+
__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>, 'LineString': <Type.LineString: 6>, 'Segment': <Type.Segment: 5>, 'Polygon': <Type.Polygon: 7>, 'Complex': <Type.Complex: 8>}
|
|
40
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
41
|
+
...
|
|
42
|
+
def __getstate__(self) -> int:
|
|
43
|
+
...
|
|
44
|
+
def __hash__(self) -> int:
|
|
45
|
+
...
|
|
46
|
+
def __index__(self) -> int:
|
|
47
|
+
...
|
|
48
|
+
def __init__(self, value: int) -> None:
|
|
49
|
+
...
|
|
50
|
+
def __int__(self) -> int:
|
|
51
|
+
...
|
|
52
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
53
|
+
...
|
|
54
|
+
def __repr__(self) -> str:
|
|
55
|
+
...
|
|
56
|
+
def __setstate__(self, state: int) -> None:
|
|
57
|
+
...
|
|
58
|
+
def __str__(self) -> str:
|
|
59
|
+
...
|
|
60
|
+
@property
|
|
61
|
+
def name(self) -> str:
|
|
62
|
+
...
|
|
63
|
+
@property
|
|
64
|
+
def value(self) -> int:
|
|
65
|
+
...
|
|
66
|
+
__hash__: typing.ClassVar[None] = None
|
|
67
|
+
@staticmethod
|
|
68
|
+
def empty() -> Intersection:
|
|
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
|
+
"""
|
|
79
|
+
@staticmethod
|
|
80
|
+
def line(line: object.Line) -> Intersection:
|
|
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
|
+
"""
|
|
94
|
+
@staticmethod
|
|
95
|
+
def point(point: object.Point) -> Intersection:
|
|
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
|
+
"""
|
|
109
|
+
@staticmethod
|
|
110
|
+
def point_set(point_set: object.PointSet) -> Intersection:
|
|
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
|
+
"""
|
|
124
|
+
@staticmethod
|
|
125
|
+
def segment(segment: object.Segment) -> Intersection:
|
|
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
|
+
"""
|
|
139
|
+
@staticmethod
|
|
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
|
+
"""
|
|
153
|
+
@staticmethod
|
|
154
|
+
def undefined() -> Intersection:
|
|
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
|
+
"""
|
|
165
|
+
def __add__(self, arg0: Intersection) -> Intersection:
|
|
166
|
+
...
|
|
167
|
+
def __eq__(self, arg0: Intersection) -> bool:
|
|
168
|
+
...
|
|
169
|
+
def __iadd__(self, arg0: Intersection) -> Intersection:
|
|
170
|
+
...
|
|
171
|
+
def __ne__(self, arg0: Intersection) -> bool:
|
|
172
|
+
...
|
|
173
|
+
def __repr__(self) -> str:
|
|
174
|
+
...
|
|
175
|
+
def __str__(self) -> str:
|
|
176
|
+
...
|
|
177
|
+
def access_composite(self) -> object.Composite:
|
|
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
|
+
"""
|
|
188
|
+
def as_composite(self) -> object.Composite:
|
|
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
|
+
"""
|
|
203
|
+
def as_line(self) -> object.Line:
|
|
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
|
+
"""
|
|
218
|
+
def as_line_string(self) -> object.LineString:
|
|
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
|
+
"""
|
|
234
|
+
def as_point(self) -> object.Point:
|
|
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
|
+
"""
|
|
248
|
+
def as_point_set(self) -> object.PointSet:
|
|
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
|
+
"""
|
|
263
|
+
def as_polygon(self) -> object.Polygon:
|
|
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
|
+
"""
|
|
279
|
+
def as_segment(self) -> object.Segment:
|
|
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
|
+
"""
|
|
294
|
+
def get_type(self) -> ...:
|
|
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
|
+
"""
|
|
305
|
+
def is_complex(self) -> bool:
|
|
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
|
+
"""
|
|
316
|
+
def is_composite(self) -> bool:
|
|
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
|
+
"""
|
|
328
|
+
def is_defined(self) -> bool:
|
|
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
|
+
"""
|
|
339
|
+
def is_empty(self) -> bool:
|
|
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
|
+
"""
|
|
350
|
+
def is_line(self) -> bool:
|
|
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
|
+
"""
|
|
362
|
+
def is_line_string(self) -> bool:
|
|
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
|
+
"""
|
|
375
|
+
def is_point(self) -> bool:
|
|
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
|
+
"""
|
|
386
|
+
def is_point_set(self) -> bool:
|
|
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
|
+
"""
|
|
398
|
+
def is_polygon(self) -> bool:
|
|
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
|
+
"""
|
|
411
|
+
def is_segment(self) -> bool:
|
|
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
|
+
"""
|
|
423
|
+
class Object:
|
|
424
|
+
class Format:
|
|
425
|
+
"""
|
|
426
|
+
Members:
|
|
427
|
+
|
|
428
|
+
Undefined
|
|
429
|
+
|
|
430
|
+
Standard
|
|
431
|
+
|
|
432
|
+
WKT
|
|
433
|
+
"""
|
|
434
|
+
Standard: typing.ClassVar[Object.Format] # value = <Format.Standard: 1>
|
|
435
|
+
Undefined: typing.ClassVar[Object.Format] # value = <Format.Undefined: 0>
|
|
436
|
+
WKT: typing.ClassVar[Object.Format] # value = <Format.WKT: 2>
|
|
437
|
+
__members__: typing.ClassVar[dict[str, Object.Format]] # value = {'Undefined': <Format.Undefined: 0>, 'Standard': <Format.Standard: 1>, 'WKT': <Format.WKT: 2>}
|
|
438
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
439
|
+
...
|
|
440
|
+
def __getstate__(self) -> int:
|
|
441
|
+
...
|
|
442
|
+
def __hash__(self) -> int:
|
|
443
|
+
...
|
|
444
|
+
def __index__(self) -> int:
|
|
445
|
+
...
|
|
446
|
+
def __init__(self, value: int) -> None:
|
|
447
|
+
...
|
|
448
|
+
def __int__(self) -> int:
|
|
449
|
+
...
|
|
450
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
451
|
+
...
|
|
452
|
+
def __repr__(self) -> str:
|
|
453
|
+
...
|
|
454
|
+
def __setstate__(self, state: int) -> None:
|
|
455
|
+
...
|
|
456
|
+
def __str__(self) -> str:
|
|
457
|
+
...
|
|
458
|
+
@property
|
|
459
|
+
def name(self) -> str:
|
|
460
|
+
...
|
|
461
|
+
@property
|
|
462
|
+
def value(self) -> int:
|
|
463
|
+
...
|
|
464
|
+
__hash__: typing.ClassVar[None] = None
|
|
465
|
+
def __eq__(self, arg0: Object) -> bool:
|
|
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
|
+
"""
|
|
480
|
+
def __ne__(self, arg0: Object) -> bool:
|
|
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
|
+
"""
|
|
495
|
+
def __repr__(self) -> str:
|
|
496
|
+
...
|
|
497
|
+
def __str__(self) -> str:
|
|
498
|
+
...
|
|
499
|
+
def apply_transformation(self, transformation: typing.Any) -> None:
|
|
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
|
+
"""
|
|
511
|
+
def contains(self, object: Object) -> bool:
|
|
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
|
+
"""
|
|
526
|
+
def intersects(self, object: Object) -> bool:
|
|
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
|
+
"""
|
|
541
|
+
def is_defined(self) -> bool:
|
|
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
|
+
"""
|
|
552
|
+
class Transformation:
|
|
553
|
+
class Type:
|
|
554
|
+
"""
|
|
555
|
+
Members:
|
|
556
|
+
|
|
557
|
+
Undefined
|
|
558
|
+
|
|
559
|
+
Identity
|
|
560
|
+
|
|
561
|
+
Translation
|
|
562
|
+
|
|
563
|
+
Rotation
|
|
564
|
+
|
|
565
|
+
Scaling
|
|
566
|
+
|
|
567
|
+
Reflection
|
|
568
|
+
|
|
569
|
+
Shear
|
|
570
|
+
|
|
571
|
+
Affine
|
|
572
|
+
"""
|
|
573
|
+
Affine: typing.ClassVar[Transformation.Type] # value = <Type.Affine: 7>
|
|
574
|
+
Identity: typing.ClassVar[Transformation.Type] # value = <Type.Identity: 1>
|
|
575
|
+
Reflection: typing.ClassVar[Transformation.Type] # value = <Type.Reflection: 5>
|
|
576
|
+
Rotation: typing.ClassVar[Transformation.Type] # value = <Type.Rotation: 3>
|
|
577
|
+
Scaling: typing.ClassVar[Transformation.Type] # value = <Type.Scaling: 4>
|
|
578
|
+
Shear: typing.ClassVar[Transformation.Type] # value = <Type.Shear: 6>
|
|
579
|
+
Translation: typing.ClassVar[Transformation.Type] # value = <Type.Translation: 2>
|
|
580
|
+
Undefined: typing.ClassVar[Transformation.Type] # value = <Type.Undefined: 0>
|
|
581
|
+
__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>}
|
|
582
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
583
|
+
...
|
|
584
|
+
def __getstate__(self) -> int:
|
|
585
|
+
...
|
|
586
|
+
def __hash__(self) -> int:
|
|
587
|
+
...
|
|
588
|
+
def __index__(self) -> int:
|
|
589
|
+
...
|
|
590
|
+
def __init__(self, value: int) -> None:
|
|
591
|
+
...
|
|
592
|
+
def __int__(self) -> int:
|
|
593
|
+
...
|
|
594
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
595
|
+
...
|
|
596
|
+
def __repr__(self) -> str:
|
|
597
|
+
...
|
|
598
|
+
def __setstate__(self, state: int) -> None:
|
|
599
|
+
...
|
|
600
|
+
def __str__(self) -> str:
|
|
601
|
+
...
|
|
602
|
+
@property
|
|
603
|
+
def name(self) -> str:
|
|
604
|
+
...
|
|
605
|
+
@property
|
|
606
|
+
def value(self) -> int:
|
|
607
|
+
...
|
|
608
|
+
__hash__: typing.ClassVar[None] = None
|
|
609
|
+
@staticmethod
|
|
610
|
+
def identity() -> Transformation:
|
|
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
|
+
"""
|
|
622
|
+
@staticmethod
|
|
623
|
+
def rotation(rotation_angle: typing.Any) -> Transformation:
|
|
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
|
+
"""
|
|
638
|
+
@staticmethod
|
|
639
|
+
def rotation_around(point: object.Point, rotation_angle: typing.Any) -> Transformation:
|
|
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
|
+
"""
|
|
656
|
+
@staticmethod
|
|
657
|
+
def string_from_type(type: typing.Any) -> ostk.core.type.String:
|
|
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
|
+
"""
|
|
670
|
+
@staticmethod
|
|
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
|
+
"""
|
|
686
|
+
@staticmethod
|
|
687
|
+
def type_of_matrix(matrix: numpy.ndarray[numpy.float64[3, 3]]) -> ...:
|
|
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
|
+
"""
|
|
702
|
+
@staticmethod
|
|
703
|
+
def undefined() -> Transformation:
|
|
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
|
+
"""
|
|
714
|
+
def __eq__(self, arg0: Transformation) -> bool:
|
|
715
|
+
...
|
|
716
|
+
def __init__(self, matrix: numpy.ndarray[numpy.float64[3, 3]]) -> None:
|
|
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
|
+
"""
|
|
728
|
+
def __ne__(self, arg0: Transformation) -> bool:
|
|
729
|
+
...
|
|
730
|
+
def __repr__(self) -> str:
|
|
731
|
+
...
|
|
732
|
+
def __str__(self) -> str:
|
|
733
|
+
...
|
|
734
|
+
@typing.overload
|
|
735
|
+
def apply_to(self, point: object.Point) -> object.Point:
|
|
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
|
+
"""
|
|
750
|
+
@typing.overload
|
|
751
|
+
def apply_to(self, vector: numpy.ndarray[numpy.float64[2, 1]]) -> numpy.ndarray[numpy.float64[2, 1]]:
|
|
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
|
+
"""
|
|
766
|
+
def get_inverse(self) -> Transformation:
|
|
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
|
+
"""
|
|
777
|
+
def get_matrix(self) -> numpy.ndarray[numpy.float64[3, 3]]:
|
|
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
|
+
"""
|
|
788
|
+
def get_type(self) -> ...:
|
|
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
|
+
"""
|
|
799
|
+
def is_defined(self) -> bool:
|
|
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
|
+
"""
|