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.
Files changed (68) hide show
  1. open_space_toolkit_mathematics-4.6.0.dist-info/METADATA +28 -0
  2. open_space_toolkit_mathematics-4.6.0.dist-info/RECORD +68 -0
  3. open_space_toolkit_mathematics-4.6.0.dist-info/WHEEL +5 -0
  4. open_space_toolkit_mathematics-4.6.0.dist-info/top_level.txt +1 -0
  5. open_space_toolkit_mathematics-4.6.0.dist-info/zip-safe +1 -0
  6. ostk/__init__.py +1 -0
  7. ostk/mathematics/OpenSpaceToolkitMathematicsPy.cpython-39-aarch64-linux-gnu.so +0 -0
  8. ostk/mathematics/__init__.py +5 -0
  9. ostk/mathematics/__init__.pyi +11 -0
  10. ostk/mathematics/curve_fitting/__init__.pyi +155 -0
  11. ostk/mathematics/curve_fitting/interpolator.pyi +243 -0
  12. ostk/mathematics/geometry/__init__.pyi +504 -0
  13. ostk/mathematics/geometry/d2/__init__.pyi +809 -0
  14. ostk/mathematics/geometry/d2/object.pyi +1779 -0
  15. ostk/mathematics/geometry/d3/__init__.pyi +1032 -0
  16. ostk/mathematics/geometry/d3/object.pyi +3709 -0
  17. ostk/mathematics/geometry/d3/transformation/__init__.pyi +3 -0
  18. ostk/mathematics/geometry/d3/transformation/rotation.pyi +1358 -0
  19. ostk/mathematics/libopen-space-toolkit-mathematics.so.4 +0 -0
  20. ostk/mathematics/object.pyi +387 -0
  21. ostk/mathematics/solver.pyi +342 -0
  22. ostk/mathematics/test/__init__.py +1 -0
  23. ostk/mathematics/test/curve_fitting/__init__.py +1 -0
  24. ostk/mathematics/test/curve_fitting/interpolator/__init__.py +1 -0
  25. ostk/mathematics/test/curve_fitting/interpolator/test_barycentric_rational.py +44 -0
  26. ostk/mathematics/test/curve_fitting/interpolator/test_cubic_spline.py +55 -0
  27. ostk/mathematics/test/curve_fitting/interpolator/test_interpolator.py +71 -0
  28. ostk/mathematics/test/curve_fitting/interpolator/test_linear.py +45 -0
  29. ostk/mathematics/test/geometry/__init__.py +1 -0
  30. ostk/mathematics/test/geometry/d2/__init__.py +1 -0
  31. ostk/mathematics/test/geometry/d2/conftest.py +79 -0
  32. ostk/mathematics/test/geometry/d2/object/__init__.py +1 -0
  33. ostk/mathematics/test/geometry/d2/object/test_composite.py +93 -0
  34. ostk/mathematics/test/geometry/d2/object/test_line.py +57 -0
  35. ostk/mathematics/test/geometry/d2/object/test_linestring.py +174 -0
  36. ostk/mathematics/test/geometry/d2/object/test_multipolygon.py +94 -0
  37. ostk/mathematics/test/geometry/d2/object/test_point.py +213 -0
  38. ostk/mathematics/test/geometry/d2/object/test_point_set.py +100 -0
  39. ostk/mathematics/test/geometry/d2/object/test_polygon.py +370 -0
  40. ostk/mathematics/test/geometry/d2/object/test_segment.py +104 -0
  41. ostk/mathematics/test/geometry/d2/test_object.py +25 -0
  42. ostk/mathematics/test/geometry/d2/test_transformation.py +84 -0
  43. ostk/mathematics/test/geometry/d3/__init__.py +1 -0
  44. ostk/mathematics/test/geometry/d3/object/__init__.py +1 -0
  45. ostk/mathematics/test/geometry/d3/object/test_composite.py +262 -0
  46. ostk/mathematics/test/geometry/d3/object/test_cuboid.py +20 -0
  47. ostk/mathematics/test/geometry/d3/object/test_line.py +68 -0
  48. ostk/mathematics/test/geometry/d3/object/test_linestring.py +168 -0
  49. ostk/mathematics/test/geometry/d3/object/test_point.py +234 -0
  50. ostk/mathematics/test/geometry/d3/object/test_point_set.py +113 -0
  51. ostk/mathematics/test/geometry/d3/object/test_polygon.py +141 -0
  52. ostk/mathematics/test/geometry/d3/object/test_segment.py +120 -0
  53. ostk/mathematics/test/geometry/d3/objects/test_cuboid.py +20 -0
  54. ostk/mathematics/test/geometry/d3/test_intersection.py +3 -0
  55. ostk/mathematics/test/geometry/d3/test_object.py +3 -0
  56. ostk/mathematics/test/geometry/d3/test_transformation.py +3 -0
  57. ostk/mathematics/test/geometry/d3/transformation/__init__.py +1 -0
  58. ostk/mathematics/test/geometry/d3/transformation/rotation/__init__.py +1 -0
  59. ostk/mathematics/test/geometry/d3/transformation/rotation/test_euler_angle.py +138 -0
  60. ostk/mathematics/test/geometry/d3/transformation/rotation/test_quaternion.py +189 -0
  61. ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_matrix.py +40 -0
  62. ostk/mathematics/test/geometry/d3/transformation/rotation/test_rotation_vector.py +47 -0
  63. ostk/mathematics/test/geometry/test_angle.py +345 -0
  64. ostk/mathematics/test/object/__init__.py +1 -0
  65. ostk/mathematics/test/object/test_interval.py +515 -0
  66. ostk/mathematics/test/object/test_vector.py +5 -0
  67. ostk/mathematics/test/solver/test_numerical_solver.py +176 -0
  68. ostk/mathematics/test/test_object.py +24 -0
@@ -0,0 +1,3709 @@
1
+ from __future__ import annotations
2
+ import numpy
3
+ import ostk.core.type
4
+ import ostk.mathematics.geometry.d2.object
5
+ import ostk.mathematics.geometry.d3
6
+ import typing
7
+ __all__ = ['Composite', 'Cone', 'Cuboid', 'Ellipsoid', 'Line', 'LineString', 'Plane', 'Point', 'PointSet', 'Polygon', 'Pyramid', 'Ray', 'Segment', 'Sphere', 'set_point_3_array']
8
+ class Composite(ostk.mathematics.geometry.d3.Object):
9
+ __hash__: typing.ClassVar[None] = None
10
+ @staticmethod
11
+ def empty() -> Composite:
12
+ """
13
+ Create an empty composite (containing no objects).
14
+
15
+ Returns:
16
+ Composite: An empty composite object.
17
+
18
+ Example:
19
+ >>> empty_composite = Composite.empty()
20
+ >>> empty_composite.is_empty() # True
21
+ >>> empty_composite.get_object_count() # 0
22
+ """
23
+ @staticmethod
24
+ def undefined() -> Composite:
25
+ """
26
+ Create an undefined composite.
27
+
28
+ Returns:
29
+ Composite: An undefined composite object.
30
+
31
+ Example:
32
+ >>> undefined_composite = Composite.undefined()
33
+ >>> undefined_composite.is_defined() # False
34
+ """
35
+ def __add__(self, arg0: Composite) -> Composite:
36
+ ...
37
+ def __eq__(self, arg0: Composite) -> bool:
38
+ ...
39
+ def __iadd__(self, arg0: Composite) -> Composite:
40
+ ...
41
+ def __init__(self, object: ostk.mathematics.geometry.d3.Object) -> None:
42
+ """
43
+ Create a composite object from a single geometric object.
44
+
45
+ Args:
46
+ object (Object): The geometric object to wrap in the composite.
47
+
48
+ Example:
49
+ >>> point = Point(1.0, 2.0, 3.0)
50
+ >>> composite = Composite(point)
51
+ """
52
+ def __ne__(self, arg0: Composite) -> bool:
53
+ ...
54
+ def __repr__(self) -> str:
55
+ ...
56
+ def __str__(self) -> str:
57
+ ...
58
+ def access_object_at(self, index: int) -> ostk.mathematics.geometry.d3.Object:
59
+ """
60
+ Access the object at a specific index in the composite.
61
+
62
+ Args:
63
+ index (int): The index of the object to access.
64
+
65
+ Returns:
66
+ Object: Reference to the object at the specified index.
67
+
68
+ Raises:
69
+ IndexError: If the index is out of bounds.
70
+
71
+ Example:
72
+ >>> composite = Composite(Point(1.0, 2.0, 3.0))
73
+ >>> obj = composite.access_object_at(0)
74
+ """
75
+ def apply_transformation(self, transformation: typing.Any) -> None:
76
+ """
77
+ Apply a transformation to all objects in the composite in place.
78
+
79
+ Args:
80
+ transformation (Transformation): The transformation to apply.
81
+
82
+ Example:
83
+ >>> composite = Composite(Point(1.0, 2.0, 3.0))
84
+ >>> transformation = Translation([1.0, 1.0, 1.0])
85
+ >>> composite.apply_transformation(transformation)
86
+ """
87
+ def as_composite(self) -> Composite:
88
+ """
89
+ Convert the composite to a Composite object.
90
+
91
+ Returns:
92
+ Composite: The composite object contained in the composite.
93
+
94
+ Raises:
95
+ RuntimeError: If the composite does not contain a Composite.
96
+
97
+ Example:
98
+ >>> inner_composite = Composite(Point(1.0, 2.0, 3.0))
99
+ >>> outer_composite = Composite(inner_composite)
100
+ >>> extracted_composite = outer_composite.as_composite()
101
+ """
102
+ def as_cone(self) -> Cone:
103
+ """
104
+ Convert the composite to a Cone object.
105
+
106
+ Returns:
107
+ Cone: The cone object contained in the composite.
108
+
109
+ Raises:
110
+ RuntimeError: If the composite does not contain a Cone.
111
+
112
+ Example:
113
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
114
+ >>> composite = Composite(cone)
115
+ >>> extracted_cone = composite.as_cone()
116
+ """
117
+ def as_ellipsoid(self) -> Ellipsoid:
118
+ """
119
+ Convert the composite to an Ellipsoid object.
120
+
121
+ Returns:
122
+ Ellipsoid: The ellipsoid object contained in the composite.
123
+
124
+ Raises:
125
+ RuntimeError: If the composite does not contain an Ellipsoid.
126
+
127
+ Example:
128
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 0.8, 0.6)
129
+ >>> composite = Composite(ellipsoid)
130
+ >>> extracted_ellipsoid = composite.as_ellipsoid()
131
+ """
132
+ def as_line(self) -> Line:
133
+ """
134
+ Convert the composite to a Line object.
135
+
136
+ Returns:
137
+ Line: The line object contained in the composite.
138
+
139
+ Raises:
140
+ RuntimeError: If the composite does not contain a Line.
141
+
142
+ Example:
143
+ >>> line = Line(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
144
+ >>> composite = Composite(line)
145
+ >>> extracted_line = composite.as_line()
146
+ """
147
+ def as_line_string(self) -> LineString:
148
+ """
149
+ Convert the composite to a LineString object.
150
+
151
+ Returns:
152
+ LineString: The line string object contained in the composite.
153
+
154
+ Raises:
155
+ RuntimeError: If the composite does not contain a LineString.
156
+
157
+ Example:
158
+ >>> points = [Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0), Point(2.0, 2.0, 2.0)]
159
+ >>> line_string = LineString(points)
160
+ >>> composite = Composite(line_string)
161
+ >>> extracted_line_string = composite.as_line_string()
162
+ """
163
+ def as_plane(self) -> Plane:
164
+ """
165
+ Convert the composite to a Plane object.
166
+
167
+ Returns:
168
+ Plane: The plane object contained in the composite.
169
+
170
+ Raises:
171
+ RuntimeError: If the composite does not contain a Plane.
172
+
173
+ Example:
174
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
175
+ >>> composite = Composite(plane)
176
+ >>> extracted_plane = composite.as_plane()
177
+ """
178
+ def as_point(self) -> Point:
179
+ """
180
+ Convert the composite to a Point object.
181
+
182
+ Returns:
183
+ Point: The point object contained in the composite.
184
+
185
+ Raises:
186
+ RuntimeError: If the composite does not contain a Point.
187
+
188
+ Example:
189
+ >>> composite = Composite(Point(1.0, 2.0, 3.0))
190
+ >>> point = composite.as_point()
191
+ """
192
+ def as_point_set(self) -> PointSet:
193
+ """
194
+ Convert the composite to a PointSet object.
195
+
196
+ Returns:
197
+ PointSet: The point set object contained in the composite.
198
+
199
+ Raises:
200
+ RuntimeError: If the composite does not contain a PointSet.
201
+
202
+ Example:
203
+ >>> point_set = PointSet([Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0)])
204
+ >>> composite = Composite(point_set)
205
+ >>> extracted_set = composite.as_point_set()
206
+ """
207
+ def as_polygon(self) -> Polygon:
208
+ """
209
+ Convert the composite to a Polygon object.
210
+
211
+ Returns:
212
+ Polygon: The polygon object contained in the composite.
213
+
214
+ Raises:
215
+ RuntimeError: If the composite does not contain a Polygon.
216
+
217
+ Example:
218
+ >>> vertices = [Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)]
219
+ >>> polygon = Polygon(vertices)
220
+ >>> composite = Composite(polygon)
221
+ >>> extracted_polygon = composite.as_polygon()
222
+ """
223
+ def as_pyramid(self) -> Pyramid:
224
+ """
225
+ Convert the composite to a Pyramid object.
226
+
227
+ Returns:
228
+ Pyramid: The pyramid object contained in the composite.
229
+
230
+ Raises:
231
+ RuntimeError: If the composite does not contain a Pyramid.
232
+
233
+ Example:
234
+ >>> apex = Point(0.0, 0.0, 1.0)
235
+ >>> base = Polygon([Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)])
236
+ >>> pyramid = Pyramid(base, apex)
237
+ >>> composite = Composite(pyramid)
238
+ >>> extracted_pyramid = composite.as_pyramid()
239
+ """
240
+ def as_ray(self) -> Ray:
241
+ """
242
+ Convert the composite to a Ray object.
243
+
244
+ Returns:
245
+ Ray: The ray object contained in the composite.
246
+
247
+ Raises:
248
+ RuntimeError: If the composite does not contain a Ray.
249
+
250
+ Example:
251
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
252
+ >>> composite = Composite(ray)
253
+ >>> extracted_ray = composite.as_ray()
254
+ """
255
+ def as_segment(self) -> Segment:
256
+ """
257
+ Convert the composite to a Segment object.
258
+
259
+ Returns:
260
+ Segment: The segment object contained in the composite.
261
+
262
+ Raises:
263
+ RuntimeError: If the composite does not contain a Segment.
264
+
265
+ Example:
266
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
267
+ >>> composite = Composite(segment)
268
+ >>> extracted_segment = composite.as_segment()
269
+ """
270
+ def as_sphere(self) -> Sphere:
271
+ """
272
+ Convert the composite to a Sphere object.
273
+
274
+ Returns:
275
+ Sphere: The sphere object contained in the composite.
276
+
277
+ Raises:
278
+ RuntimeError: If the composite does not contain a Sphere.
279
+
280
+ Example:
281
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
282
+ >>> composite = Composite(sphere)
283
+ >>> extracted_sphere = composite.as_sphere()
284
+ """
285
+ @typing.overload
286
+ def contains(self, object: ostk.mathematics.geometry.d3.Object) -> bool:
287
+ """
288
+ Check if the composite contains another geometric object.
289
+
290
+ Args:
291
+ object (Object): The object to check containment for.
292
+
293
+ Returns:
294
+ bool: True if the composite contains the object, False otherwise.
295
+
296
+ Example:
297
+ >>> composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 2.0))
298
+ >>> point = Point(0.5, 0.0, 0.0)
299
+ >>> composite.contains(point) # True
300
+ """
301
+ @typing.overload
302
+ def contains(self, composite: Composite) -> bool:
303
+ """
304
+ Check if the composite contains another composite.
305
+
306
+ Args:
307
+ composite (Composite): The composite to check containment for.
308
+
309
+ Returns:
310
+ bool: True if this composite contains the other composite, False otherwise.
311
+
312
+ Example:
313
+ >>> outer_composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 2.0))
314
+ >>> inner_composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
315
+ >>> outer_composite.contains(inner_composite) # True
316
+ """
317
+ def get_object_count(self) -> int:
318
+ """
319
+ Get the number of objects contained in the composite.
320
+
321
+ Returns:
322
+ int: The number of objects in the composite.
323
+
324
+ Example:
325
+ >>> composite = Composite(Point(1.0, 2.0, 3.0))
326
+ >>> count = composite.get_object_count() # 1
327
+ """
328
+ @typing.overload
329
+ def intersection_with(self, object: ostk.mathematics.geometry.d3.Object) -> ...:
330
+ """
331
+ Compute the intersection of the composite with another geometric object.
332
+
333
+ Args:
334
+ object (Object): The object to compute intersection with.
335
+
336
+ Returns:
337
+ Intersection: The intersection result.
338
+
339
+ Example:
340
+ >>> composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
341
+ >>> line = Line(Point(-2.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
342
+ >>> intersection = composite.intersection_with(line)
343
+ """
344
+ @typing.overload
345
+ def intersection_with(self, composite: Composite) -> ...:
346
+ """
347
+ Compute the intersection of the composite with another composite.
348
+
349
+ Args:
350
+ composite (Composite): The composite to compute intersection with.
351
+
352
+ Returns:
353
+ Intersection: The intersection result.
354
+
355
+ Example:
356
+ >>> composite1 = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
357
+ >>> composite2 = Composite(Sphere(Point(1.5, 0.0, 0.0), 1.0))
358
+ >>> intersection = composite1.intersection_with(composite2)
359
+ """
360
+ @typing.overload
361
+ def intersects(self, object: ostk.mathematics.geometry.d3.Object) -> bool:
362
+ """
363
+ Check if the composite intersects with another geometric object.
364
+
365
+ Args:
366
+ object (Object): The object to check intersection with.
367
+
368
+ Returns:
369
+ bool: True if the composite intersects the object, False otherwise.
370
+
371
+ Example:
372
+ >>> composite = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
373
+ >>> point = Point(0.5, 0.0, 0.0)
374
+ >>> composite.intersects(point) # True
375
+ """
376
+ @typing.overload
377
+ def intersects(self, composite: Composite) -> bool:
378
+ """
379
+ Check if the composite intersects with another composite.
380
+
381
+ Args:
382
+ composite (Composite): The composite to check intersection with.
383
+
384
+ Returns:
385
+ bool: True if the composites intersect, False otherwise.
386
+
387
+ Example:
388
+ >>> composite1 = Composite(Sphere(Point(0.0, 0.0, 0.0), 1.0))
389
+ >>> composite2 = Composite(Sphere(Point(1.5, 0.0, 0.0), 1.0))
390
+ >>> composite1.intersects(composite2) # True
391
+ """
392
+ def is_composite(self) -> bool:
393
+ """
394
+ Check if the composite contains another Composite object.
395
+
396
+ Returns:
397
+ bool: True if the composite contains a Composite, False otherwise.
398
+
399
+ Example:
400
+ >>> inner_composite = Composite(Point(1.0, 2.0, 3.0))
401
+ >>> outer_composite = Composite(inner_composite)
402
+ >>> outer_composite.is_composite() # True
403
+ """
404
+ def is_cone(self) -> bool:
405
+ """
406
+ Check if the composite contains a Cone object.
407
+
408
+ Returns:
409
+ bool: True if the composite contains a Cone, False otherwise.
410
+
411
+ Example:
412
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
413
+ >>> composite = Composite(cone)
414
+ >>> composite.is_cone() # True
415
+ """
416
+ def is_defined(self) -> bool:
417
+ """
418
+ Check if the composite is defined.
419
+
420
+ Returns:
421
+ bool: True if the composite is defined, False otherwise.
422
+
423
+ Example:
424
+ >>> composite = Composite(Point(1.0, 2.0, 3.0))
425
+ >>> composite.is_defined() # True
426
+ """
427
+ def is_ellipsoid(self) -> bool:
428
+ """
429
+ Check if the composite contains an Ellipsoid object.
430
+
431
+ Returns:
432
+ bool: True if the composite contains an Ellipsoid, False otherwise.
433
+
434
+ Example:
435
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 0.8, 0.6)
436
+ >>> composite = Composite(ellipsoid)
437
+ >>> composite.is_ellipsoid() # True
438
+ """
439
+ def is_empty(self) -> bool:
440
+ """
441
+ Check if the composite is empty (contains no objects).
442
+
443
+ Returns:
444
+ bool: True if the composite is empty, False otherwise.
445
+
446
+ Example:
447
+ >>> empty_composite = Composite.empty()
448
+ >>> empty_composite.is_empty() # True
449
+ """
450
+ def is_line(self) -> bool:
451
+ """
452
+ Check if the composite contains a Line object.
453
+
454
+ Returns:
455
+ bool: True if the composite contains a Line, False otherwise.
456
+
457
+ Example:
458
+ >>> line = Line(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
459
+ >>> composite = Composite(line)
460
+ >>> composite.is_line() # True
461
+ """
462
+ def is_line_string(self) -> bool:
463
+ """
464
+ Check if the composite contains a LineString object.
465
+
466
+ Returns:
467
+ bool: True if the composite contains a LineString, False otherwise.
468
+
469
+ Example:
470
+ >>> points = [Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0), Point(2.0, 2.0, 2.0)]
471
+ >>> line_string = LineString(points)
472
+ >>> composite = Composite(line_string)
473
+ >>> composite.is_line_string() # True
474
+ """
475
+ def is_plane(self) -> bool:
476
+ """
477
+ Check if the composite contains a Plane object.
478
+
479
+ Returns:
480
+ bool: True if the composite contains a Plane, False otherwise.
481
+
482
+ Example:
483
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
484
+ >>> composite = Composite(plane)
485
+ >>> composite.is_plane() # True
486
+ """
487
+ def is_point(self) -> bool:
488
+ """
489
+ Check if the composite contains a Point object.
490
+
491
+ Returns:
492
+ bool: True if the composite contains a Point, False otherwise.
493
+
494
+ Example:
495
+ >>> composite = Composite(Point(1.0, 2.0, 3.0))
496
+ >>> composite.is_point() # True
497
+ """
498
+ def is_point_set(self) -> bool:
499
+ """
500
+ Check if the composite contains a PointSet object.
501
+
502
+ Returns:
503
+ bool: True if the composite contains a PointSet, False otherwise.
504
+
505
+ Example:
506
+ >>> point_set = PointSet([Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0)])
507
+ >>> composite = Composite(point_set)
508
+ >>> composite.is_point_set() # True
509
+ """
510
+ def is_polygon(self) -> bool:
511
+ """
512
+ Check if the composite contains a Polygon object.
513
+
514
+ Returns:
515
+ bool: True if the composite contains a Polygon, False otherwise.
516
+
517
+ Example:
518
+ >>> vertices = [Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)]
519
+ >>> polygon = Polygon(vertices)
520
+ >>> composite = Composite(polygon)
521
+ >>> composite.is_polygon() # True
522
+ """
523
+ def is_pyramid(self) -> bool:
524
+ """
525
+ Check if the composite contains a Pyramid object.
526
+
527
+ Returns:
528
+ bool: True if the composite contains a Pyramid, False otherwise.
529
+
530
+ Example:
531
+ >>> apex = Point(0.0, 0.0, 1.0)
532
+ >>> base = Polygon([Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0), Point(1.0, 1.0, 0.0)])
533
+ >>> pyramid = Pyramid(base, apex)
534
+ >>> composite = Composite(pyramid)
535
+ >>> composite.is_pyramid() # True
536
+ """
537
+ def is_ray(self) -> bool:
538
+ """
539
+ Check if the composite contains a Ray object.
540
+
541
+ Returns:
542
+ bool: True if the composite contains a Ray, False otherwise.
543
+
544
+ Example:
545
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
546
+ >>> composite = Composite(ray)
547
+ >>> composite.is_ray() # True
548
+ """
549
+ def is_segment(self) -> bool:
550
+ """
551
+ Check if the composite contains a Segment object.
552
+
553
+ Returns:
554
+ bool: True if the composite contains a Segment, False otherwise.
555
+
556
+ Example:
557
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
558
+ >>> composite = Composite(segment)
559
+ >>> composite.is_segment() # True
560
+ """
561
+ def is_sphere(self) -> bool:
562
+ """
563
+ Check if the composite contains a Sphere object.
564
+
565
+ Returns:
566
+ bool: True if the composite contains a Sphere, False otherwise.
567
+
568
+ Example:
569
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
570
+ >>> composite = Composite(sphere)
571
+ >>> composite.is_sphere() # True
572
+ """
573
+ class Cone(ostk.mathematics.geometry.d3.Object):
574
+ __hash__: typing.ClassVar[None] = None
575
+ @staticmethod
576
+ def undefined() -> Cone:
577
+ """
578
+ Create an undefined cone.
579
+
580
+ Returns:
581
+ Cone: An undefined cone object.
582
+
583
+ Example:
584
+ >>> undefined_cone = Cone.undefined()
585
+ >>> undefined_cone.is_defined() # False
586
+ """
587
+ def __eq__(self, arg0: Cone) -> bool:
588
+ ...
589
+ def __init__(self, apex: Point, axis: numpy.ndarray[numpy.float64[3, 1]], angle: typing.Any) -> None:
590
+ """
591
+ Create a 3D cone with specified apex, axis, and angle.
592
+
593
+ Args:
594
+ apex (Point): The apex (tip) point of the cone.
595
+ axis (np.array): The axis direction vector of the cone.
596
+ angle (Angle): The half-angle of the cone opening.
597
+
598
+ Example:
599
+ >>> apex = Point(0.0, 0.0, 0.0)
600
+ >>> axis = np.array([0.0, 0.0, 1.0])
601
+ >>> angle = Angle.degrees(30.0)
602
+ >>> cone = Cone(apex, axis, angle)
603
+ """
604
+ def __ne__(self, arg0: Cone) -> bool:
605
+ ...
606
+ def __repr__(self) -> str:
607
+ ...
608
+ def __str__(self) -> str:
609
+ ...
610
+ def apply_transformation(self, transformation: typing.Any) -> None:
611
+ """
612
+ Apply a transformation to the cone in place.
613
+
614
+ Args:
615
+ transformation (Transformation): The transformation to apply.
616
+
617
+ Example:
618
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
619
+ >>> transformation = Translation([1.0, 2.0, 3.0])
620
+ >>> cone.apply_transformation(transformation)
621
+ """
622
+ @typing.overload
623
+ def contains(self, point: Point) -> bool:
624
+ """
625
+ Check if the cone contains a point.
626
+
627
+ Args:
628
+ point (Point): The point to check.
629
+
630
+ Returns:
631
+ bool: True if the cone contains the point, False otherwise.
632
+
633
+ Example:
634
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
635
+ >>> cone.contains(Point(0.1, 0.1, 1.0)) # True for point inside cone
636
+ """
637
+ @typing.overload
638
+ def contains(self, point_set: PointSet) -> bool:
639
+ """
640
+ Check if the cone contains a point set.
641
+
642
+ Args:
643
+ point_set (PointSet): The point set to check.
644
+
645
+ Returns:
646
+ bool: True if the cone contains the point set, False otherwise.
647
+
648
+ Example:
649
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
650
+ >>> cone.contains(PointSet([Point(0.1, 0.1, 1.0), Point(0.2, 0.2, 1.0)])) # True for points inside cone
651
+ """
652
+ @typing.overload
653
+ def contains(self, segment: Segment) -> bool:
654
+ """
655
+ Check if the cone contains a segment.
656
+
657
+ Args:
658
+ segment (Segment): The segment to check.
659
+
660
+ Returns:
661
+ bool: True if the cone contains the segment, False otherwise.
662
+
663
+ Example:
664
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
665
+ >>> cone.contains(Segment(Point(0.1, 0.1, 1.0), Point(0.2, 0.2, 1.0))) # True for segment inside cone
666
+ """
667
+ @typing.overload
668
+ def contains(self, ray: Ray) -> bool:
669
+ """
670
+ Check if the cone contains a ray.
671
+
672
+ Args:
673
+ ray (Ray): The ray to check.
674
+
675
+ Returns:
676
+ bool: True if the cone contains the ray, False otherwise.
677
+
678
+ Example:
679
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
680
+ >>> cone.contains(Ray(Point(0.1, 0.1, 1.0), np.array([0.0, 0.0, 1.0]))) # True for ray inside cone
681
+ """
682
+ @typing.overload
683
+ def contains(self, sphere: Sphere) -> bool:
684
+ """
685
+ Check if the cone contains a sphere.
686
+
687
+ Args:
688
+ sphere (Sphere): The sphere to check.
689
+
690
+ Returns:
691
+ bool: True if the cone contains the sphere, False otherwise.
692
+
693
+ Example:
694
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
695
+ >>> cone.contains(Sphere(Point(0.1, 0.1, 1.0), 0.1)) # True for sphere inside cone
696
+ """
697
+ @typing.overload
698
+ def contains(self, ellipsoid: Ellipsoid) -> bool:
699
+ """
700
+ Check if the cone contains an ellipsoid.
701
+ Args:
702
+ ellipsoid (Ellipsoid): The ellipsoid to check.
703
+
704
+ Returns:
705
+ bool: True if the cone contains the ellipsoid, False otherwise.
706
+
707
+ Example:
708
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
709
+ >>> cone.contains(Ellipsoid(Point(0.1, 0.1, 1.0), 0.1, 0.1, 0.1)) # True for ellipsoid inside cone
710
+ """
711
+ def distance_to(self, point: Point) -> ostk.core.type.Real:
712
+ """
713
+ Calculate the distance from the cone to a point.
714
+
715
+ Args:
716
+ point (Point): The point to calculate distance to.
717
+
718
+ Returns:
719
+ float: The minimum distance from the cone surface to the point.
720
+
721
+ Example:
722
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
723
+ >>> distance = cone.distance_to(Point(2.0, 0.0, 0.0))
724
+ """
725
+ def get_angle(self) -> ...:
726
+ """
727
+ Get the half-angle of the cone opening.
728
+
729
+ Returns:
730
+ Angle: The half-angle of the cone.
731
+
732
+ Example:
733
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
734
+ >>> angle = cone.get_angle() # 30 degrees
735
+ """
736
+ def get_apex(self) -> Point:
737
+ """
738
+ Get the apex (tip) point of the cone.
739
+
740
+ Returns:
741
+ Point: The apex point of the cone.
742
+
743
+ Example:
744
+ >>> cone = Cone(Point(1.0, 2.0, 3.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
745
+ >>> apex = cone.get_apex() # Point(1.0, 2.0, 3.0)
746
+ """
747
+ def get_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
748
+ """
749
+ Get the axis direction vector of the cone.
750
+
751
+ Returns:
752
+ Vector3d: The axis direction vector.
753
+
754
+ Example:
755
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
756
+ >>> axis = cone.get_axis() # [0.0, 0.0, 1.0]
757
+ """
758
+ def get_rays_of_lateral_surface(self, ray_count: int = 0) -> list[Ray]:
759
+ """
760
+ Get rays representing the lateral surface of the cone.
761
+
762
+ Args:
763
+ ray_count (int): Number of rays to generate around the surface.
764
+
765
+ Returns:
766
+ list: Array of Ray objects representing the lateral surface.
767
+
768
+ Example:
769
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
770
+ >>> rays = cone.get_rays_of_lateral_surface(8)
771
+ """
772
+ @typing.overload
773
+ def intersection_with(self, sphere: Sphere, only_in_sight: bool = False, discretization_level: int = 40) -> ...:
774
+ """
775
+ Compute intersection of cone with sphere.
776
+
777
+ Args:
778
+ sphere (Sphere): The sphere to intersect with.
779
+ only_in_sight (bool): If true, only return intersection points that are in sight.
780
+ discretization_level (int): The discretization level for the intersection.
781
+
782
+ Returns:
783
+ Intersection: The intersection of the cone with the sphere.
784
+
785
+ Example:
786
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
787
+ >>> sphere = Sphere(Point(2.0, 0.0, 0.0), 1.0)
788
+ >>> intersection = cone.intersection_with(sphere)
789
+ >>> intersection.get_point() # Point(2.0, 0.0, 0.0)
790
+ """
791
+ @typing.overload
792
+ def intersection_with(self, ellipsoid: Ellipsoid, only_in_sight: bool = False, discretization_level: int = 40) -> ...:
793
+ """
794
+ Compute intersection of cone with ellipsoid.
795
+
796
+ Args:
797
+ ellipsoid (Ellipsoid): The ellipsoid to intersect with.
798
+ only_in_sight (bool): If true, only return intersection points that are in sight.
799
+ discretization_level (int): The discretization level for the intersection.
800
+
801
+ Returns:
802
+ Intersection: The intersection of the cone with the ellipsoid.
803
+
804
+ Example:
805
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
806
+ >>> ellipsoid = Ellipsoid(Point(2.0, 0.0, 0.0), 1.0, 1.0, 1.0)
807
+ >>> intersection = cone.intersection_with(ellipsoid)
808
+ >>> intersection.get_point() # Point(2.0, 0.0, 0.0)
809
+ """
810
+ @typing.overload
811
+ def intersects(self, sphere: Sphere, discretization_level: int = 40) -> bool:
812
+ """
813
+ Check if the cone intersects with a sphere.
814
+
815
+ Args:
816
+ sphere (Sphere): The sphere to check intersection with.
817
+ discretization_level (int): Level of discretization for intersection calculation.
818
+
819
+ Returns:
820
+ bool: True if the cone intersects the sphere, False otherwise.
821
+
822
+ Example:
823
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
824
+ >>> sphere = Sphere(Point(1.0, 0.0, 1.0), 0.5)
825
+ >>> cone.intersects(sphere)
826
+ """
827
+ @typing.overload
828
+ def intersects(self, ellipsoid: Ellipsoid, discretization_level: int = 40) -> bool:
829
+ """
830
+ Check if the cone intersects with an ellipsoid.
831
+
832
+ Args:
833
+ ellipsoid (Ellipsoid): The ellipsoid to check intersection with.
834
+ discretization_level (int): Level of discretization for intersection calculation.
835
+
836
+ Returns:
837
+ bool: True if the cone intersects the ellipsoid, False otherwise.
838
+
839
+ Example:
840
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
841
+ >>> ellipsoid = Ellipsoid(Point(1.0, 0.0, 1.0), 1.0, 0.8, 0.6)
842
+ >>> cone.intersects(ellipsoid)
843
+ """
844
+ def is_defined(self) -> bool:
845
+ """
846
+ Check if the cone is defined.
847
+
848
+ Returns:
849
+ bool: True if the cone is defined, False otherwise.
850
+
851
+ Example:
852
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]), Angle.degrees(30.0))
853
+ >>> cone.is_defined() # True
854
+ """
855
+ class Cuboid(ostk.mathematics.geometry.d3.Object):
856
+ __hash__: typing.ClassVar[None] = None
857
+ @staticmethod
858
+ def cube(center: Point, extent: ostk.core.type.Real) -> Cuboid:
859
+ """
860
+ Create a cube (equal extents along all axes) centered at a point.
861
+
862
+ Args:
863
+ center (Point): The center point of the cube.
864
+ extent (float): The half-extent along all axes.
865
+
866
+ Returns:
867
+ Cuboid: A cuboid representing a cube.
868
+
869
+ Example:
870
+ >>> center = Point(0.0, 0.0, 0.0)
871
+ >>> cube = Cuboid.cube(center, 1.0) # 2x2x2 cube
872
+ """
873
+ @staticmethod
874
+ def undefined() -> Cuboid:
875
+ """
876
+ Create an undefined cuboid.
877
+
878
+ Returns:
879
+ Cuboid: An undefined cuboid object.
880
+
881
+ Example:
882
+ >>> undefined_cuboid = Cuboid.undefined()
883
+ >>> undefined_cuboid.is_defined() # False
884
+ """
885
+ def __eq__(self, arg0: Cuboid) -> bool:
886
+ ...
887
+ def __init__(self, center: Point, axes: list, extent: list) -> None:
888
+ """
889
+ Create a 3D cuboid with specified center, axes, and extents.
890
+
891
+ Args:
892
+ center (Point): The center point of the cuboid.
893
+ axes (list): List of three Vector3d objects defining the cuboid's orientation.
894
+ extent (list): List of three float values defining the half-extents along each axis.
895
+
896
+ Example:
897
+ >>> center = Point(0.0, 0.0, 0.0)
898
+ >>> axes = [np.array([1.0, 0.0, 0.0]), np.array([0.0, 1.0, 0.0]), np.array([0.0, 0.0, 1.0])]
899
+ >>> extent = [1.0, 2.0, 3.0]
900
+ >>> cuboid = Cuboid(center, axes, extent)
901
+ """
902
+ def __ne__(self, arg0: Cuboid) -> bool:
903
+ ...
904
+ def __repr__(self) -> str:
905
+ ...
906
+ def __str__(self) -> str:
907
+ ...
908
+ def apply_transformation(self, transformation: typing.Any) -> None:
909
+ """
910
+ Apply a transformation to the cuboid in place.
911
+
912
+ Args:
913
+ transformation (Transformation): The transformation to apply.
914
+
915
+ Example:
916
+ >>> cuboid = Cuboid(center, axes, extent)
917
+ >>> transformation = Translation([1.0, 2.0, 3.0])
918
+ >>> cuboid.apply_transformation(transformation)
919
+ """
920
+ def get_center(self) -> Point:
921
+ """
922
+ Get the center point of the cuboid.
923
+
924
+ Returns:
925
+ Point: The center point of the cuboid.
926
+
927
+ Example:
928
+ >>> cuboid = Cuboid(Point(1.0, 2.0, 3.0), axes, extent)
929
+ >>> center = cuboid.get_center() # Point(1.0, 2.0, 3.0)
930
+ """
931
+ def get_first_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
932
+ """
933
+ Get the first axis vector of the cuboid.
934
+
935
+ Returns:
936
+ Vector3d: The first axis direction vector.
937
+
938
+ Example:
939
+ >>> cuboid = Cuboid(center, axes, extent)
940
+ >>> first_axis = cuboid.get_first_axis()
941
+ """
942
+ def get_first_extent(self) -> ostk.core.type.Real:
943
+ """
944
+ Get the first half-extent of the cuboid.
945
+
946
+ Returns:
947
+ float: The half-extent along the first axis.
948
+
949
+ Example:
950
+ >>> cuboid = Cuboid(center, axes, [1.0, 2.0, 3.0])
951
+ >>> first_extent = cuboid.get_first_extent() # 1.0
952
+ """
953
+ def get_second_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
954
+ """
955
+ Get the second axis vector of the cuboid.
956
+
957
+ Returns:
958
+ Vector3d: The second axis direction vector.
959
+
960
+ Example:
961
+ >>> cuboid = Cuboid(center, axes, extent)
962
+ >>> second_axis = cuboid.get_second_axis()
963
+ """
964
+ def get_second_extent(self) -> ostk.core.type.Real:
965
+ """
966
+ Get the second half-extent of the cuboid.
967
+
968
+ Returns:
969
+ float: The half-extent along the second axis.
970
+
971
+ Example:
972
+ >>> cuboid = Cuboid(center, axes, [1.0, 2.0, 3.0])
973
+ >>> second_extent = cuboid.get_second_extent() # 2.0
974
+ """
975
+ def get_third_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
976
+ """
977
+ Get the third axis vector of the cuboid.
978
+
979
+ Returns:
980
+ Vector3d: The third axis direction vector.
981
+
982
+ Example:
983
+ >>> cuboid = Cuboid(center, axes, extent)
984
+ >>> third_axis = cuboid.get_third_axis()
985
+ """
986
+ def get_third_extent(self) -> ostk.core.type.Real:
987
+ """
988
+ Get the third half-extent of the cuboid.
989
+
990
+ Returns:
991
+ float: The half-extent along the third axis.
992
+
993
+ Example:
994
+ >>> cuboid = Cuboid(center, axes, [1.0, 2.0, 3.0])
995
+ >>> third_extent = cuboid.get_third_extent() # 3.0
996
+ """
997
+ def get_vertices(self) -> list[Point]:
998
+ """
999
+ Get all vertices of the cuboid.
1000
+
1001
+ Returns:
1002
+ list: Array of Point objects representing the 8 vertices of the cuboid.
1003
+
1004
+ Example:
1005
+ >>> cuboid = Cuboid(center, axes, extent)
1006
+ >>> vertices = cuboid.get_vertices() # 8 corner points
1007
+ """
1008
+ @typing.overload
1009
+ def intersects(self, point: Point) -> bool:
1010
+ """
1011
+ Check if the cuboid intersects a point.
1012
+
1013
+ Args:
1014
+ point (Point): The point to check.
1015
+
1016
+ Returns:
1017
+ bool: True if the cuboid intersects the point, False otherwise.
1018
+
1019
+ Example:
1020
+ >>> cuboid = Cuboid(Point(0.0, 0.0, 0.0), axes, extent)
1021
+ >>> cuboid.intersects(Point(1.0, 2.0, 3.0)) # True
1022
+ """
1023
+ @typing.overload
1024
+ def intersects(self, point_set: PointSet) -> bool:
1025
+ """
1026
+ Check if the cuboid intersects a point set.
1027
+
1028
+ Args:
1029
+ point_set (PointSet): The point set to check.
1030
+
1031
+ Returns:
1032
+ bool: True if the cuboid intersects the point set, False otherwise.
1033
+
1034
+ Example:
1035
+ >>> cuboid = Cuboid(Point(0.0, 0.0, 0.0), axes, extent)
1036
+ >>> cuboid.intersects(PointSet([Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0)])) # True
1037
+ """
1038
+ @typing.overload
1039
+ def intersects(self, line: Line) -> bool:
1040
+ """
1041
+ Check if the cuboid intersects a line.
1042
+
1043
+ Args:
1044
+ line (Line): The line to check.
1045
+
1046
+ Returns:
1047
+ bool: True if the cuboid intersects the line, False otherwise.
1048
+
1049
+ Example:
1050
+ >>> cuboid = Cuboid(Point(0.0, 0.0, 0.0), axes, extent)
1051
+ >>> cuboid.intersects(Line(Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0))) # True
1052
+ """
1053
+ @typing.overload
1054
+ def intersects(self, cuboid: Cuboid) -> bool:
1055
+ """
1056
+ Check if the cuboid intersects a cuboid.
1057
+
1058
+ Args:
1059
+ cuboid (Cuboid): The cuboid to check.
1060
+
1061
+ Returns:
1062
+ bool: True if the cuboid intersects the cuboid, False otherwise.
1063
+ """
1064
+ def is_defined(self) -> bool:
1065
+ """
1066
+ Check if the cuboid is defined.
1067
+
1068
+ Returns:
1069
+ bool: True if the cuboid is defined, False otherwise.
1070
+
1071
+ Example:
1072
+ >>> cuboid = Cuboid(center, axes, extent)
1073
+ >>> cuboid.is_defined() # True
1074
+ """
1075
+ def is_near(self, arg0: Cuboid, arg1: ostk.core.type.Real) -> bool:
1076
+ """
1077
+ Check if this cuboid is near another cuboid.
1078
+
1079
+ Args:
1080
+ cuboid (Cuboid): The cuboid to compare with.
1081
+ tolerance (float): The tolerance for comparison.
1082
+
1083
+ Returns:
1084
+ bool: True if cuboids are within tolerance, False otherwise.
1085
+
1086
+ Example:
1087
+ >>> cuboid1 = Cuboid(center1, axes1, extent1)
1088
+ >>> cuboid2 = Cuboid(center2, axes2, extent2)
1089
+ >>> cuboid1.is_near(cuboid2, 1e-6)
1090
+ """
1091
+ class Ellipsoid(ostk.mathematics.geometry.d3.Object):
1092
+ __hash__: typing.ClassVar[None] = None
1093
+ @staticmethod
1094
+ def undefined() -> Ellipsoid:
1095
+ """
1096
+ Create an undefined ellipsoid.
1097
+
1098
+ Returns:
1099
+ Ellipsoid: An undefined ellipsoid object.
1100
+
1101
+ Example:
1102
+ >>> undefined_ellipsoid = Ellipsoid.undefined()
1103
+ >>> undefined_ellipsoid.is_defined() # False
1104
+ """
1105
+ def __eq__(self, arg0: Ellipsoid) -> bool:
1106
+ ...
1107
+ @typing.overload
1108
+ def __init__(self, center: Point, first_principal_semi_axis: ostk.core.type.Real, second_principal_semi_axis: ostk.core.type.Real, third_principal_semi_axis: ostk.core.type.Real) -> None:
1109
+ """
1110
+ Create an ellipsoid with specified center and semi-axes.
1111
+
1112
+ Args:
1113
+ center (Point): The center point of the ellipsoid.
1114
+ first_principal_semi_axis (float): The first principal semi-axis length.
1115
+ second_principal_semi_axis (float): The second principal semi-axis length.
1116
+ third_principal_semi_axis (float): The third principal semi-axis length.
1117
+
1118
+ Example:
1119
+ >>> center = Point(0.0, 0.0, 0.0)
1120
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1121
+ """
1122
+ @typing.overload
1123
+ def __init__(self, center: Point, first_principal_semi_axis: ostk.core.type.Real, second_principal_semi_axis: ostk.core.type.Real, third_principal_semi_axis: ostk.core.type.Real, orientation: typing.Any) -> None:
1124
+ """
1125
+ Create an ellipsoid with specified center, semi-axes, and orientation.
1126
+
1127
+ Args:
1128
+ center (Point): The center point of the ellipsoid.
1129
+ first_principal_semi_axis (float): The first principal semi-axis length.
1130
+ second_principal_semi_axis (float): The second principal semi-axis length.
1131
+ third_principal_semi_axis (float): The third principal semi-axis length.
1132
+ orientation (Quaternion): The orientation of the ellipsoid.
1133
+
1134
+ Example:
1135
+ >>> center = Point(0.0, 0.0, 0.0)
1136
+ >>> orientation = Quaternion.unit()
1137
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0, orientation)
1138
+ """
1139
+ def __ne__(self, arg0: Ellipsoid) -> bool:
1140
+ ...
1141
+ def __repr__(self) -> str:
1142
+ ...
1143
+ def __str__(self) -> str:
1144
+ ...
1145
+ def apply_transformation(self, transformation: typing.Any) -> None:
1146
+ """
1147
+ Apply a transformation to the ellipsoid in place.
1148
+
1149
+ Args:
1150
+ transformation (Transformation): The transformation to apply.
1151
+
1152
+ Example:
1153
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1154
+ >>> transformation = Translation([1.0, 2.0, 3.0])
1155
+ >>> ellipsoid.apply_transformation(transformation)
1156
+ """
1157
+ @typing.overload
1158
+ def contains(self, point: Point) -> bool:
1159
+ """
1160
+ Check if the ellipsoid contains a point.
1161
+
1162
+ Args:
1163
+ point (Point): The point to check.
1164
+
1165
+ Returns:
1166
+ bool: True if the ellipsoid contains the point, False otherwise.
1167
+
1168
+ Example:
1169
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1170
+ >>> ellipsoid.contains(Point(0.5, 0.5, 0.5)) # True if inside
1171
+ """
1172
+ @typing.overload
1173
+ def contains(self, point_set: PointSet) -> bool:
1174
+ """
1175
+ Check if the ellipsoid contains a point set.
1176
+
1177
+ Args:
1178
+ point_set (PointSet): The point set to check.
1179
+
1180
+ Returns:
1181
+ bool: True if the ellipsoid contains the point set, False otherwise.
1182
+
1183
+ Example:
1184
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1185
+ >>> ellipsoid.contains(PointSet([Point(0.5, 0.5, 0.5), Point(1.0, 1.0, 1.0)])) # True if inside
1186
+ """
1187
+ @typing.overload
1188
+ def contains(self, segment: Segment) -> bool:
1189
+ """
1190
+ Check if the ellipsoid contains a segment.
1191
+
1192
+ Args:
1193
+ segment (Segment): The segment to check.
1194
+
1195
+ Returns:
1196
+ bool: True if the ellipsoid contains the segment, False otherwise.
1197
+
1198
+ Example:
1199
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1200
+ >>> ellipsoid.contains(Segment(Point(0.5, 0.5, 0.5), Point(1.0, 1.0, 1.0))) # True if inside
1201
+ """
1202
+ def get_center(self) -> Point:
1203
+ """
1204
+ Get the center point of the ellipsoid.
1205
+
1206
+ Returns:
1207
+ Point: The center point of the ellipsoid.
1208
+
1209
+ Example:
1210
+ >>> ellipsoid = Ellipsoid(Point(1.0, 2.0, 3.0), 2.0, 1.5, 1.0)
1211
+ >>> center = ellipsoid.get_center() # Point(1.0, 2.0, 3.0)
1212
+ """
1213
+ def get_first_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
1214
+ """
1215
+ Get the first axis of the ellipsoid.
1216
+
1217
+ Returns:
1218
+ np.array: The first axis of the ellipsoid.
1219
+
1220
+ Example:
1221
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1222
+ >>> first_axis = ellipsoid.get_first_axis() # np.array([1.0, 0.0, 0.0])
1223
+ """
1224
+ def get_first_principal_semi_axis(self) -> ostk.core.type.Real:
1225
+ """
1226
+ Get the first principal semi-axis length.
1227
+
1228
+ Returns:
1229
+ float: The length of the first principal semi-axis.
1230
+
1231
+ Example:
1232
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1233
+ >>> first_axis = ellipsoid.get_first_principal_semi_axis() # 2.0
1234
+ """
1235
+ def get_matrix(self) -> numpy.ndarray[numpy.float64[3, 3]]:
1236
+ """
1237
+ Get the matrix of the ellipsoid.
1238
+
1239
+ Returns:
1240
+ np.array: The matrix of the ellipsoid.
1241
+
1242
+ Example:
1243
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1244
+ >>> matrix = ellipsoid.get_matrix() # np.array([[1.0, 0.0, 0.0], [0.0, 1.0, 0.0], [0.0, 0.0, 1.0]])
1245
+ """
1246
+ def get_orientation(self) -> ...:
1247
+ """
1248
+ Get the orientation quaternion of the ellipsoid.
1249
+
1250
+ Returns:
1251
+ Quaternion: The orientation quaternion of the ellipsoid.
1252
+
1253
+ Example:
1254
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0, orientation)
1255
+ >>> quat = ellipsoid.get_orientation()
1256
+ """
1257
+ def get_second_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
1258
+ """
1259
+ Get the second axis of the ellipsoid.
1260
+
1261
+ Returns:
1262
+ np.array: The second axis of the ellipsoid.
1263
+
1264
+ Example:
1265
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1266
+ >>> second_axis = ellipsoid.get_second_axis() # np.array([0.0, 1.0, 0.0])
1267
+ """
1268
+ def get_second_principal_semi_axis(self) -> ostk.core.type.Real:
1269
+ """
1270
+ Get the second principal semi-axis length.
1271
+
1272
+ Returns:
1273
+ float: The length of the second principal semi-axis.
1274
+
1275
+ Example:
1276
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1277
+ >>> second_axis = ellipsoid.get_second_principal_semi_axis() # 1.5
1278
+ """
1279
+ def get_third_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
1280
+ """
1281
+ Get the third axis of the ellipsoid.
1282
+
1283
+ Returns:
1284
+ np.array: The third axis of the ellipsoid.
1285
+
1286
+ Example:
1287
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1288
+ >>> third_axis = ellipsoid.get_third_axis() # np.array([0.0, 0.0, 1.0])
1289
+ """
1290
+ def get_third_principal_semi_axis(self) -> ostk.core.type.Real:
1291
+ """
1292
+ Get the third principal semi-axis length.
1293
+
1294
+ Returns:
1295
+ float: The length of the third principal semi-axis.
1296
+
1297
+ Example:
1298
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1299
+ >>> third_axis = ellipsoid.get_third_principal_semi_axis() # 1.0
1300
+ """
1301
+ @typing.overload
1302
+ def intersection(self, line: Line) -> ...:
1303
+ ...
1304
+ @typing.overload
1305
+ def intersection(self, ray: Ray, only_in_sight: bool) -> ...:
1306
+ ...
1307
+ @typing.overload
1308
+ def intersection(self, segment: Segment) -> ...:
1309
+ ...
1310
+ @typing.overload
1311
+ def intersection(self, pyramid: typing.Any, only_in_sight: bool) -> ...:
1312
+ ...
1313
+ @typing.overload
1314
+ def intersection(self, cone: typing.Any, only_in_sight: bool) -> ...:
1315
+ ...
1316
+ @typing.overload
1317
+ def intersection_with(self, line: Line) -> ...:
1318
+ """
1319
+ Get the intersection of the ellipsoid with a line.
1320
+
1321
+ Args:
1322
+ line (Line): The line to intersect with.
1323
+
1324
+ Returns:
1325
+ Intersection: The intersection of the ellipsoid with the line.
1326
+
1327
+ Example:
1328
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1329
+ >>> line = Line.points(Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0))
1330
+ >>> intersection = ellipsoid.intersection_with(line)
1331
+ >>> intersection.get_point() # Point(0.0, 0.0, 0.0)
1332
+ """
1333
+ @typing.overload
1334
+ def intersection_with(self, ray: Ray, only_in_sight: bool = False) -> ...:
1335
+ """
1336
+ Get the intersection of the ellipsoid with a ray.
1337
+
1338
+ Args:
1339
+ ray (Ray): The ray to intersect with.
1340
+ only_in_sight (bool, optional): If true, only return intersection points that are in sight. Defaults to False.
1341
+
1342
+ Returns:
1343
+ Intersection: The intersection of the ellipsoid with the ray.
1344
+
1345
+ Example:
1346
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1347
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0))
1348
+ >>> intersection = ellipsoid.intersection_with(ray)
1349
+ >>> intersection.get_point() # Point(0.0, 0.0, 0.0)
1350
+ """
1351
+ @typing.overload
1352
+ def intersection_with(self, segment: Segment) -> ...:
1353
+ """
1354
+ Get the intersection of the ellipsoid with a segment.
1355
+
1356
+ Args:
1357
+ segment (Segment): The segment to intersect with.
1358
+
1359
+ Returns:
1360
+ Intersection: The intersection of the ellipsoid with the segment.
1361
+
1362
+ Example:
1363
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1364
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0))
1365
+ >>> intersection = ellipsoid.intersection_with(segment)
1366
+ >>> intersection.get_point() # Point(0.0, 0.0, 0.0)
1367
+ """
1368
+ @typing.overload
1369
+ def intersection_with(self, pyramid: typing.Any, only_in_sight: bool = False) -> ...:
1370
+ """
1371
+ Get the intersection of the ellipsoid with a pyramid.
1372
+
1373
+ Args:
1374
+ pyramid (Pyramid): The pyramid to intersect with.
1375
+ only_in_sight (bool, optional): If true, only return intersection points that are in sight. Defaults to False.
1376
+
1377
+ Returns:
1378
+ Intersection: The intersection of the ellipsoid with the pyramid.
1379
+
1380
+ Example:
1381
+ >>> origin = Point(0.0, 0.0, 0.0)
1382
+ >>> ellipsoid = Ellipsoid(origin, 2.0, 1.5, 1.0)
1383
+ >>> polygon2d = Polygon2d([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
1384
+ >>> x_axis = np.array([1.0, 0.0, 0.0])
1385
+ >>> y_axis = np.array([0.0, 1.0, 0.0])
1386
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
1387
+ >>> pyramid = Pyramid(polygon, Point(0.0, 0.0, 1.0))
1388
+ >>> intersection = ellipsoid.intersection_with(pyramid)
1389
+ >>> intersection.get_point()
1390
+ """
1391
+ @typing.overload
1392
+ def intersection_with(self, cone: typing.Any, only_in_sight: bool = False) -> ...:
1393
+ """
1394
+ Get the intersection of the ellipsoid with a cone.
1395
+
1396
+ Args:
1397
+ cone (Cone): The cone to intersect with.
1398
+ only_in_sight (bool, optional): If true, only return intersection points that are in sight. Defaults to False.
1399
+
1400
+ Returns:
1401
+ Intersection: The intersection of the ellipsoid with the cone.
1402
+
1403
+ Example:
1404
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1405
+ >>> cone = Cone(Point(0.0, 0.0, 0.0), [1.0, 0.0, 0.0], Angle.degrees(30.0))
1406
+ >>> intersection = ellipsoid.intersection_with(cone)
1407
+ >>> intersection.get_point()
1408
+ """
1409
+ @typing.overload
1410
+ def intersects(self, point: Point) -> bool:
1411
+ """
1412
+ Check if the ellipsoid intersects a point.
1413
+
1414
+ Args:
1415
+ point (Point): The point to check.
1416
+
1417
+ Returns:
1418
+ bool: True if the ellipsoid intersects the point, False otherwise.
1419
+
1420
+ Example:
1421
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1422
+ >>> ellipsoid.intersects(Point(0.5, 0.5, 0.5)) # True
1423
+ """
1424
+ @typing.overload
1425
+ def intersects(self, point_set: PointSet) -> bool:
1426
+ """
1427
+ Check if the ellipsoid intersects a point set.
1428
+
1429
+ Args:
1430
+ point_set (PointSet): The point set to check.
1431
+
1432
+ Returns:
1433
+ bool: True if the ellipsoid intersects the point set, False otherwise.
1434
+
1435
+ Example:
1436
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1437
+ >>> ellipsoid.intersects(PointSet([Point(0.5, 0.5, 0.5), Point(1.0, 1.0, 1.0)])) # True
1438
+ """
1439
+ @typing.overload
1440
+ def intersects(self, line: Line) -> bool:
1441
+ """
1442
+ Check if the ellipsoid intersects a line.
1443
+
1444
+ Args:
1445
+ line (Line): The line to check.
1446
+
1447
+ Returns:
1448
+ bool: True if the ellipsoid intersects the line, False otherwise.
1449
+
1450
+ Example:
1451
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1452
+ >>> ellipsoid.intersects(Line.points(Point(0.5, 0.5, 0.5), Point(1.0, 1.0, 1.0))) # True
1453
+ """
1454
+ @typing.overload
1455
+ def intersects(self, ray: Ray) -> bool:
1456
+ """
1457
+ Check if the ellipsoid intersects a ray.
1458
+
1459
+ Args:
1460
+ ray (Ray): The ray to check.
1461
+
1462
+ Returns:
1463
+ bool: True if the ellipsoid intersects the ray, False otherwise.
1464
+
1465
+ Example:
1466
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1467
+ >>> ellipsoid.intersects(Ray(Point(0.5, 0.5, 0.5), [1.0, 0.0, 0.0])) # True
1468
+ """
1469
+ @typing.overload
1470
+ def intersects(self, segment: Segment) -> bool:
1471
+ """
1472
+ Check if the ellipsoid intersects a segment.
1473
+
1474
+ Args:
1475
+ segment (Segment): The segment to check.
1476
+
1477
+ Returns:
1478
+ bool: True if the ellipsoid intersects the segment, False otherwise.
1479
+
1480
+ Example:
1481
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1482
+ >>> ellipsoid.intersects(Segment(Point(0.5, 0.5, 0.5), Point(1.0, 1.0, 1.0))) # True
1483
+ """
1484
+ @typing.overload
1485
+ def intersects(self, plane: Plane) -> bool:
1486
+ """
1487
+ Check if the ellipsoid intersects a plane.
1488
+
1489
+ Args:
1490
+ plane (Plane): The plane to check.
1491
+
1492
+ Returns:
1493
+ bool: True if the ellipsoid intersects the plane, False otherwise.
1494
+
1495
+ Example:
1496
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 2.0, 1.5, 1.0)
1497
+ >>> ellipsoid.intersects(Plane(Point(0.5, 0.5, 0.5), Vector3d(1.0, 1.0, 1.0))) # True
1498
+ """
1499
+ def is_defined(self) -> bool:
1500
+ """
1501
+ Check if the ellipsoid is defined.
1502
+
1503
+ Returns:
1504
+ bool: True if the ellipsoid is defined, False otherwise.
1505
+
1506
+ Example:
1507
+ >>> ellipsoid = Ellipsoid(center, 2.0, 1.5, 1.0)
1508
+ >>> ellipsoid.is_defined() # True
1509
+ """
1510
+ class Line(ostk.mathematics.geometry.d3.Object):
1511
+ """
1512
+
1513
+ An infinite line in 3D space.
1514
+
1515
+ A Line is defined by an origin point and a direction vector.
1516
+
1517
+ Example:
1518
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1519
+ >>> line.is_defined() # True
1520
+
1521
+ """
1522
+ __hash__: typing.ClassVar[None] = None
1523
+ @staticmethod
1524
+ def points(first_point: Point, second_point: Point) -> Line:
1525
+ """
1526
+ Create a line passing through two points.
1527
+
1528
+ Args:
1529
+ first_point (Point): The first point.
1530
+ second_point (Point): The second point.
1531
+
1532
+ Returns:
1533
+ Line: A line passing through both points.
1534
+
1535
+ Example:
1536
+ >>> point1 = Point(0.0, 0.0)
1537
+ >>> point2 = Point(1.0, 1.0)
1538
+ >>> line = Line.points(point1, point2)
1539
+ >>> line.is_defined() # True
1540
+ """
1541
+ @staticmethod
1542
+ def undefined() -> Line:
1543
+ """
1544
+ Create an undefined line.
1545
+
1546
+ Returns:
1547
+ Line: An undefined line.
1548
+
1549
+ Example:
1550
+ >>> undefined_line = Line.undefined()
1551
+ >>> undefined_line.is_defined() # False
1552
+ """
1553
+ def __eq__(self, arg0: Line) -> bool:
1554
+ ...
1555
+ def __init__(self, origin: Point, direction: numpy.ndarray[numpy.float64[3, 1]]) -> None:
1556
+ """
1557
+ Construct a line from an origin point and direction vector.
1558
+
1559
+ Args:
1560
+ origin (Point): A point on the line.
1561
+ direction (numpy.ndarray): The direction vector of the line.
1562
+
1563
+ Example:
1564
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1565
+ >>> line.is_defined() # True
1566
+ """
1567
+ def __ne__(self, arg0: Line) -> bool:
1568
+ ...
1569
+ def __repr__(self) -> str:
1570
+ ...
1571
+ def __str__(self) -> str:
1572
+ ...
1573
+ def apply_transformation(self, transformation: typing.Any) -> None:
1574
+ """
1575
+ Apply a transformation to the line in place.
1576
+
1577
+ Args:
1578
+ transformation (Transformation): The transformation to apply.
1579
+
1580
+ Example:
1581
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1582
+ >>> transformation = Translation([1.0, 1.0])
1583
+ >>> line.apply_transformation(transformation)
1584
+ """
1585
+ @typing.overload
1586
+ def contains(self, point: Point) -> bool:
1587
+ """
1588
+ Check if the line contains a point.
1589
+
1590
+ Args:
1591
+ point (Point): The point to check.
1592
+
1593
+ Returns:
1594
+ bool: True if the line contains the point.
1595
+
1596
+ Example:
1597
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1598
+ >>> line.contains(Point(0.5, 0.5)) # True
1599
+ """
1600
+ @typing.overload
1601
+ def contains(self, point_set: PointSet) -> bool:
1602
+ """
1603
+ Check if the line contains all points in a point set.
1604
+
1605
+ Args:
1606
+ point_set (PointSet): The point set to check.
1607
+
1608
+ Returns:
1609
+ bool: True if the line contains all points.
1610
+
1611
+ Example:
1612
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1613
+ >>> points = PointSet([Point(0.5, 0.5), Point(0.25, 0.25)])
1614
+ >>> line.contains(points) # True
1615
+ """
1616
+ def distance_to(self, point: Point) -> ostk.core.type.Real:
1617
+ """
1618
+ Calculate the distance from the line to a point.
1619
+
1620
+ Args:
1621
+ point (Point): The point to measure distance to.
1622
+
1623
+ Returns:
1624
+ float: The distance to the point.
1625
+
1626
+ Example:
1627
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1628
+ >>> distance = line.distance_to(Point(0.5, 1.0)) # 1.0
1629
+ """
1630
+ def get_direction(self) -> numpy.ndarray[numpy.float64[3, 1]]:
1631
+ """
1632
+ Get the direction vector of the line.
1633
+
1634
+ Returns:
1635
+ numpy.ndarray: The direction vector.
1636
+
1637
+ Example:
1638
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1639
+ >>> direction = line.get_direction() # [1.0, 0.0, 0.0]
1640
+ """
1641
+ def get_origin(self) -> Point:
1642
+ """
1643
+ Get the origin point of the line.
1644
+
1645
+ Returns:
1646
+ Point: The origin point.
1647
+
1648
+ Example:
1649
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1650
+ >>> origin = line.get_origin() # Point(0.0, 0.0, 0.0)
1651
+ """
1652
+ def intersection_with(self, plane: typing.Any) -> ...:
1653
+ """
1654
+ Compute the intersection of the line with a plane.
1655
+
1656
+ Args:
1657
+ plane (Plane): The plane to intersect with.
1658
+
1659
+ Returns:
1660
+ Intersection: The intersection result.
1661
+
1662
+ Example:
1663
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1664
+ >>> plane = Plane(Point(1.0, 0.0, 0.0), Vector3d(0.0, 0.0, 1.0))
1665
+ >>> intersection = line.intersection_with(plane)
1666
+ >>> intersection.get_point() # Point(1.0, 0.0, 0.0)
1667
+ """
1668
+ @typing.overload
1669
+ def intersects(self, point: Point) -> bool:
1670
+ """
1671
+ Check if the line intersects a point.
1672
+
1673
+ Args:
1674
+ point (Point): The point to check intersection with.
1675
+
1676
+ Returns:
1677
+ bool: True if the line intersects the point.
1678
+
1679
+ Example:
1680
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1681
+ >>> line.intersects(Point(0.5, 0.5)) # True
1682
+ """
1683
+ @typing.overload
1684
+ def intersects(self, plane: typing.Any) -> bool:
1685
+ """
1686
+ Check if the line intersects a plane.
1687
+
1688
+ Args:
1689
+ plane (Plane): The plane to check intersection with.
1690
+
1691
+ Returns:
1692
+ bool: True if the line intersects the plane.
1693
+
1694
+ Example:
1695
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1696
+ >>> plane = Plane(Point(1.0, 0.0, 0.0), Vector3d(0.0, 0.0, 1.0))
1697
+ >>> line.intersects(plane) # True
1698
+ """
1699
+ @typing.overload
1700
+ def intersects(self, sphere: typing.Any) -> bool:
1701
+ """
1702
+ Check if the line intersects a sphere.
1703
+
1704
+ Args:
1705
+ sphere (Sphere): The sphere to check intersection with.
1706
+
1707
+ Returns:
1708
+ bool: True if the line intersects the sphere.
1709
+
1710
+ Example:
1711
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1712
+ >>> sphere = Sphere(Point(1.0, 0.0, 0.0), 1.0)
1713
+ >>> line.intersects(sphere) # True
1714
+ """
1715
+ @typing.overload
1716
+ def intersects(self, ellipsoid: typing.Any) -> bool:
1717
+ """
1718
+ Check if the line intersects an ellipsoid.
1719
+
1720
+ Args:
1721
+ ellipsoid (Ellipsoid): The ellipsoid to check intersection with.
1722
+
1723
+ Returns:
1724
+ bool: True if the line intersects the ellipsoid.
1725
+
1726
+ Example:
1727
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1728
+ >>> ellipsoid = Ellipsoid(Point(2.0, 0.0, 0.0), 1.0, 1.0, 1.0)
1729
+ >>> line.intersects(ellipsoid) # True
1730
+ """
1731
+ def is_defined(self) -> bool:
1732
+ """
1733
+ Check if the line is defined.
1734
+
1735
+ Returns:
1736
+ bool: True if the line is defined.
1737
+
1738
+ Example:
1739
+ >>> line = Line.points(Point(0.0, 0.0), Point(1.0, 0.0))
1740
+ >>> line.is_defined() # True
1741
+ """
1742
+ class LineString(ostk.mathematics.geometry.d3.Object):
1743
+ """
1744
+
1745
+ A sequence of connected line segments in 3D space.
1746
+
1747
+ A LineString is an ordered sequence of points forming a polyline.
1748
+
1749
+ Example:
1750
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
1751
+ >>> line_string = LineString(points)
1752
+ >>> line_string.is_defined() # True
1753
+
1754
+ """
1755
+ __hash__: typing.ClassVar[None] = None
1756
+ @staticmethod
1757
+ def empty() -> LineString:
1758
+ """
1759
+ Create an empty line string.
1760
+
1761
+ Returns:
1762
+ LineString: An empty line string.
1763
+
1764
+ Example:
1765
+ >>> line_string = LineString.empty()
1766
+ >>> line_string.is_empty() # True
1767
+ """
1768
+ @staticmethod
1769
+ def segment(segment: Segment) -> LineString:
1770
+ """
1771
+ Create a line string from a segment.
1772
+
1773
+ Args:
1774
+ segment (Segment): The segment to convert.
1775
+
1776
+ Returns:
1777
+ LineString: A line string representing the segment.
1778
+
1779
+ Example:
1780
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
1781
+ >>> line_string = LineString.segment(segment)
1782
+ >>> line_string.is_defined() # True
1783
+ """
1784
+ def __eq__(self, arg0: LineString) -> bool:
1785
+ ...
1786
+ def __getitem__(self, index: int) -> Point:
1787
+ ...
1788
+ def __init__(self, points: list[Point]) -> None:
1789
+ """
1790
+ Construct a line string from an array of points.
1791
+
1792
+ Args:
1793
+ points (list[Point]): Array of 3D points defining the line string.
1794
+
1795
+ Example:
1796
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
1797
+ >>> line_string = LineString(points)
1798
+ >>> line_string.is_defined() # True
1799
+ """
1800
+ def __iter__(self) -> typing.Iterator[Point]:
1801
+ ...
1802
+ def __len__(self) -> int:
1803
+ ...
1804
+ def __ne__(self, arg0: LineString) -> bool:
1805
+ ...
1806
+ def __repr__(self) -> str:
1807
+ ...
1808
+ def __str__(self) -> str:
1809
+ ...
1810
+ def access_point_at(self, index: int) -> Point:
1811
+ """
1812
+ Access a point at a given index.
1813
+
1814
+ Args:
1815
+ index (int): The index of the point.
1816
+
1817
+ Returns:
1818
+ Point: Reference to the point at the index.
1819
+
1820
+ Example:
1821
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
1822
+ >>> line_string = LineString(points)
1823
+ >>> line_string.access_point_at(0) # Point(0.0, 0.0)
1824
+ """
1825
+ def apply_transformation(self, transformation: typing.Any) -> None:
1826
+ """
1827
+ Apply a transformation to all points in the line string.
1828
+
1829
+ Args:
1830
+ transformation (Transformation): The transformation to apply.
1831
+
1832
+ Example:
1833
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
1834
+ >>> line_string = LineString(points)
1835
+ >>> transformation = Transformation.translation([1.0, 0.0])
1836
+ >>> line_string.apply_transformation(transformation)
1837
+ """
1838
+ def get_point_closest_to(self, point: Point) -> Point:
1839
+ """
1840
+ Get the point in the line string closest to a given point.
1841
+
1842
+ Args:
1843
+ point (Point): The reference point.
1844
+
1845
+ Returns:
1846
+ Point: The closest point in the line string.
1847
+
1848
+ Example:
1849
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
1850
+ >>> line_string = LineString(points)
1851
+ >>> line_string.get_point_closest_to(Point(0.5, 0.5)) # Point(0.5, 0.5)
1852
+ """
1853
+ def get_point_count(self) -> int:
1854
+ """
1855
+ Get the number of points in the line string.
1856
+
1857
+ Returns:
1858
+ int: The number of points.
1859
+
1860
+ Example:
1861
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
1862
+ >>> line_string = LineString(points)
1863
+ >>> line_string.get_point_count() # 2
1864
+ """
1865
+ def is_defined(self) -> bool:
1866
+ """
1867
+ Check if the line string is defined.
1868
+
1869
+ Returns:
1870
+ bool: True if the line string is defined.
1871
+
1872
+ Example:
1873
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
1874
+ >>> line_string = LineString(points)
1875
+ >>> line_string.is_defined() # True
1876
+ """
1877
+ def is_empty(self) -> bool:
1878
+ """
1879
+ Check if the line string is empty.
1880
+
1881
+ Returns:
1882
+ bool: True if the line string contains no points.
1883
+
1884
+ Example:
1885
+ >>> line_string = LineString.empty()
1886
+ >>> line_string.is_empty() # True
1887
+ """
1888
+ def is_near(self, line_string: LineString, tolerance: ostk.core.type.Real) -> bool:
1889
+ """
1890
+ Check if another line string is near this one within a tolerance.
1891
+
1892
+ Args:
1893
+ line_string (LineString): The line string to compare against.
1894
+ tolerance (float): The maximum distance for points to be considered near.
1895
+
1896
+ Returns:
1897
+ bool: True if the line strings are near each other.
1898
+
1899
+ Example:
1900
+ >>> line_string = LineString(points)
1901
+ >>> line_string.is_near(LineString(points), 0.1) # True
1902
+ """
1903
+ class Plane(ostk.mathematics.geometry.d3.Object):
1904
+ __hash__: typing.ClassVar[None] = None
1905
+ @staticmethod
1906
+ def undefined() -> Plane:
1907
+ """
1908
+ Create an undefined plane.
1909
+
1910
+ Returns:
1911
+ Plane: An undefined plane.
1912
+
1913
+ Example:
1914
+ >>> undefined_plane = Plane.undefined()
1915
+ >>> undefined_plane.is_defined() # False
1916
+ """
1917
+ def __eq__(self, arg0: Plane) -> bool:
1918
+ ...
1919
+ def __init__(self, point: Point, normal_vector: numpy.ndarray[numpy.float64[3, 1]]) -> None:
1920
+ """
1921
+ Create a 3D plane from a point and normal vector.
1922
+
1923
+ Args:
1924
+ point (Point): A point on the plane.
1925
+ normal_vector (np.array): The normal vector to the plane.
1926
+
1927
+ Example:
1928
+ >>> point = Point(0.0, 0.0, 0.0)
1929
+ >>> normal = np.array([0.0, 0.0, 1.0])
1930
+ >>> plane = Plane(point, normal)
1931
+ """
1932
+ def __ne__(self, arg0: Plane) -> bool:
1933
+ ...
1934
+ def __repr__(self) -> str:
1935
+ ...
1936
+ def __str__(self) -> str:
1937
+ ...
1938
+ def apply_transformation(self, transformation: typing.Any) -> None:
1939
+ """
1940
+ Apply a transformation to the plane.
1941
+
1942
+ Args:
1943
+ transformation (Transformation): The transformation to apply.
1944
+
1945
+ Returns:
1946
+ Plane: The transformed plane.
1947
+
1948
+ Example:
1949
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
1950
+ >>> transformation = Transformation.identity()
1951
+ >>> transformed = plane.apply_transformation(transformation)
1952
+ """
1953
+ @typing.overload
1954
+ def contains(self, point: Point) -> bool:
1955
+ """
1956
+ Check if the plane contains a point.
1957
+
1958
+ Args:
1959
+ point (Point): The point to check.
1960
+
1961
+ Returns:
1962
+ bool: True if the plane contains the point, False otherwise.
1963
+
1964
+ Example:
1965
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
1966
+ >>> plane.contains(Point(1.0, 1.0, 0.0)) # True (z=0 plane)
1967
+ """
1968
+ @typing.overload
1969
+ def contains(self, point_set: PointSet) -> bool:
1970
+ """
1971
+ Check if the plane contains a point set.
1972
+
1973
+ Args:
1974
+ point_set (PointSet): The point set to check.
1975
+
1976
+ Returns:
1977
+ bool: True if the plane contains all points in the set, False otherwise.
1978
+
1979
+ Example:
1980
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
1981
+ >>> points = PointSet([Point(1.0, 1.0, 0.0), Point(2.0, 2.0, 0.0)])
1982
+ >>> plane.contains(points) # True
1983
+ """
1984
+ @typing.overload
1985
+ def contains(self, line: Line) -> bool:
1986
+ """
1987
+ Check if the plane contains a line.
1988
+
1989
+ Args:
1990
+ line (Line): The line to check.
1991
+
1992
+ Returns:
1993
+ bool: True if the plane contains the entire line, False otherwise.
1994
+
1995
+ Example:
1996
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
1997
+ >>> line = Line(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
1998
+ >>> plane.contains(line) # True (line lies in z=0 plane)
1999
+ """
2000
+ @typing.overload
2001
+ def contains(self, ray: Ray) -> bool:
2002
+ """
2003
+ Check if the plane contains a ray.
2004
+
2005
+ Args:
2006
+ ray (Ray): The ray to check.
2007
+
2008
+ Returns:
2009
+ bool: True if the plane contains the entire ray, False otherwise.
2010
+
2011
+ Example:
2012
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2013
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
2014
+ >>> plane.contains(ray) # True
2015
+ """
2016
+ @typing.overload
2017
+ def contains(self, segment: Segment) -> bool:
2018
+ """
2019
+ Check if the plane contains a segment.
2020
+
2021
+ Args:
2022
+ segment (Segment): The segment to check.
2023
+
2024
+ Returns:
2025
+ bool: True if the plane contains the entire segment, False otherwise.
2026
+
2027
+ Example:
2028
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2029
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0))
2030
+ >>> plane.contains(segment) # True
2031
+ """
2032
+ def get_normal_vector(self) -> numpy.ndarray[numpy.float64[3, 1]]:
2033
+ """
2034
+ Get the normal vector of the plane.
2035
+
2036
+ Returns:
2037
+ Vector3d: The normal vector to the plane.
2038
+
2039
+ Example:
2040
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2041
+ >>> normal = plane.get_normal_vector() # [0.0, 0.0, 1.0]
2042
+ """
2043
+ def get_point(self) -> Point:
2044
+ """
2045
+ Get a reference point on the plane.
2046
+
2047
+ Returns:
2048
+ Point: A point on the plane.
2049
+
2050
+ Example:
2051
+ >>> plane = Plane(Point(1.0, 2.0, 3.0), np.array([0.0, 0.0, 1.0]))
2052
+ >>> point = plane.get_point()
2053
+ """
2054
+ @typing.overload
2055
+ def intersection_with(self, point: Point) -> ...:
2056
+ """
2057
+ Compute the intersection of the plane with a point.
2058
+
2059
+ Args:
2060
+ point (Point): The point to intersect with.
2061
+
2062
+ Returns:
2063
+ Intersection: The intersection result.
2064
+
2065
+ Example:
2066
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2067
+ >>> intersection = plane.intersection_with(Point(1.0, 1.0, 0.0))
2068
+ """
2069
+ @typing.overload
2070
+ def intersection_with(self, point_set: PointSet) -> ...:
2071
+ """
2072
+ Compute the intersection of the plane with a point set.
2073
+
2074
+ Args:
2075
+ point_set (PointSet): The point set to intersect with.
2076
+
2077
+ Returns:
2078
+ Intersection: The intersection result.
2079
+
2080
+ Example:
2081
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2082
+ >>> points = PointSet([Point(1.0, 1.0, 0.0), Point(2.0, 2.0, 1.0)])
2083
+ >>> intersection = plane.intersection_with(points)
2084
+ """
2085
+ @typing.overload
2086
+ def intersection_with(self, line: Line) -> ...:
2087
+ """
2088
+ Compute the intersection of the plane with a line.
2089
+
2090
+ Args:
2091
+ line (Line): The line to intersect with.
2092
+
2093
+ Returns:
2094
+ Intersection: The intersection result (point or line if coplanar).
2095
+
2096
+ Example:
2097
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2098
+ >>> line = Line(Point(0.0, 0.0, -1.0), np.array([0.0, 0.0, 1.0]))
2099
+ >>> intersection = plane.intersection_with(line)
2100
+ """
2101
+ @typing.overload
2102
+ def intersection_with(self, ray: Ray) -> ...:
2103
+ """
2104
+ Compute the intersection of the plane with a ray.
2105
+
2106
+ Args:
2107
+ ray (Ray): The ray to intersect with.
2108
+
2109
+ Returns:
2110
+ Intersection: The intersection result.
2111
+
2112
+ Example:
2113
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2114
+ >>> ray = Ray(Point(0.0, 0.0, -1.0), np.array([0.0, 0.0, 1.0]))
2115
+ >>> intersection = plane.intersection_with(ray)
2116
+ """
2117
+ @typing.overload
2118
+ def intersection_with(self, segment: Segment) -> ...:
2119
+ """
2120
+ Compute the intersection of the plane with a segment.
2121
+
2122
+ Args:
2123
+ segment (Segment): The segment to intersect with.
2124
+
2125
+ Returns:
2126
+ Intersection: The intersection result.
2127
+
2128
+ Example:
2129
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2130
+ >>> segment = Segment(Point(0.0, 0.0, -1.0), Point(0.0, 0.0, 1.0))
2131
+ >>> intersection = plane.intersection_with(segment)
2132
+ """
2133
+ @typing.overload
2134
+ def intersects(self, point: Point) -> bool:
2135
+ """
2136
+ Check if the plane intersects with a point.
2137
+
2138
+ Args:
2139
+ point (Point): The point to check.
2140
+
2141
+ Returns:
2142
+ bool: True if the plane intersects the point, False otherwise.
2143
+
2144
+ Example:
2145
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2146
+ >>> plane.intersects(Point(1.0, 1.0, 0.0)) # True
2147
+ """
2148
+ @typing.overload
2149
+ def intersects(self, point_set: PointSet) -> bool:
2150
+ """
2151
+ Check if the plane intersects with a point set.
2152
+
2153
+ Args:
2154
+ point_set (PointSet): The point set to check.
2155
+
2156
+ Returns:
2157
+ bool: True if the plane intersects the point set, False otherwise.
2158
+
2159
+ Example:
2160
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2161
+ >>> points = PointSet([Point(1.0, 1.0, 0.0), Point(2.0, 2.0, 0.0)])
2162
+ >>> plane.intersects(points) # True
2163
+ """
2164
+ @typing.overload
2165
+ def intersects(self, line: Line) -> bool:
2166
+ """
2167
+ Check if the plane intersects with a line.
2168
+
2169
+ Args:
2170
+ line (Line): The line to check.
2171
+
2172
+ Returns:
2173
+ bool: True if the plane intersects the line, False otherwise.
2174
+
2175
+ Example:
2176
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2177
+ >>> line = Line(Point(0.0, 0.0, -1.0), np.array([0.0, 0.0, 1.0]))
2178
+ >>> plane.intersects(line) # True
2179
+ """
2180
+ @typing.overload
2181
+ def intersects(self, ray: Ray) -> bool:
2182
+ """
2183
+ Check if the plane intersects with a ray.
2184
+
2185
+ Args:
2186
+ ray (Ray): The ray to check.
2187
+
2188
+ Returns:
2189
+ bool: True if the plane intersects the ray, False otherwise.
2190
+
2191
+ Example:
2192
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2193
+ >>> ray = Ray(Point(0.0, 0.0, -1.0), np.array([0.0, 0.0, 1.0]))
2194
+ >>> plane.intersects(ray) # True
2195
+ """
2196
+ @typing.overload
2197
+ def intersects(self, segment: Segment) -> bool:
2198
+ """
2199
+ Check if the plane intersects with a segment.
2200
+
2201
+ Args:
2202
+ segment (Segment): The segment to check.
2203
+
2204
+ Returns:
2205
+ bool: True if the plane intersects the segment, False otherwise.
2206
+
2207
+ Example:
2208
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2209
+ >>> segment = Segment(Point(0.0, 0.0, -1.0), Point(0.0, 0.0, 1.0))
2210
+ >>> plane.intersects(segment) # True
2211
+ """
2212
+ def is_defined(self) -> bool:
2213
+ """
2214
+ Check if the plane is defined.
2215
+
2216
+ Returns:
2217
+ bool: True if the plane is defined, False otherwise.
2218
+
2219
+ Example:
2220
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
2221
+ >>> plane.is_defined() # True
2222
+ """
2223
+ class Point(ostk.mathematics.geometry.d3.Object):
2224
+ __hash__: typing.ClassVar[None] = None
2225
+ @staticmethod
2226
+ def origin() -> Point:
2227
+ """
2228
+ Create a point at the origin (0, 0, 0).
2229
+
2230
+ Returns:
2231
+ Point: A point at coordinates (0, 0, 0).
2232
+
2233
+ Example:
2234
+ >>> origin = Point.origin()
2235
+ >>> origin.x() # 0.0
2236
+ >>> origin.y() # 0.0
2237
+ >>> origin.z() # 0.0
2238
+ """
2239
+ @staticmethod
2240
+ def undefined() -> Point:
2241
+ """
2242
+ Create an undefined point.
2243
+
2244
+ Returns:
2245
+ Point: An undefined point.
2246
+
2247
+ Example:
2248
+ >>> undefined_point = Point.undefined()
2249
+ >>> undefined_point.is_defined() # False
2250
+ """
2251
+ @staticmethod
2252
+ def vector(vector: numpy.ndarray[numpy.float64[3, 1]]) -> Point:
2253
+ """
2254
+ Create a point from a 3D vector.
2255
+
2256
+ Args:
2257
+ vector (np.array): The vector to convert to a point.
2258
+
2259
+ Returns:
2260
+ Point: A point with coordinates from the vector.
2261
+
2262
+ Example:
2263
+ >>> vector = np.array([1.0, 2.0, 3.0])
2264
+ >>> point = Point.vector(vector) # Point(1.0, 2.0, 3.0)
2265
+ """
2266
+ def __add__(self, arg0: numpy.ndarray[numpy.float64[3, 1]]) -> Point:
2267
+ ...
2268
+ def __eq__(self, arg0: Point) -> bool:
2269
+ ...
2270
+ def __init__(self, first_coordinate: ostk.core.type.Real, second_coordinate: ostk.core.type.Real, third_coordinate: ostk.core.type.Real) -> None:
2271
+ """
2272
+ Create a 3D point with specified coordinates.
2273
+
2274
+ Args:
2275
+ first_coordinate (float): The x-coordinate.
2276
+ second_coordinate (float): The y-coordinate.
2277
+ third_coordinate (float): The z-coordinate.
2278
+
2279
+ Example:
2280
+ >>> point = Point(1.0, 2.0, 3.0)
2281
+ >>> point.x() # 1.0
2282
+ >>> point.y() # 2.0
2283
+ >>> point.z() # 3.0
2284
+ """
2285
+ def __ne__(self, arg0: Point) -> bool:
2286
+ ...
2287
+ def __repr__(self) -> str:
2288
+ ...
2289
+ def __str__(self) -> str:
2290
+ ...
2291
+ @typing.overload
2292
+ def __sub__(self, arg0: numpy.ndarray[numpy.float64[3, 1]]) -> Point:
2293
+ ...
2294
+ @typing.overload
2295
+ def __sub__(self, arg0: Point) -> numpy.ndarray[numpy.float64[3, 1]]:
2296
+ ...
2297
+ def apply_transformation(self, transformation: typing.Any) -> None:
2298
+ """
2299
+ Apply a transformation to the point.
2300
+
2301
+ Args:
2302
+ transformation (Transformation): The transformation to apply.
2303
+
2304
+ Returns:
2305
+ Point: The transformed point.
2306
+
2307
+ Example:
2308
+ >>> point = Point(1.0, 2.0, 3.0)
2309
+ >>> transformation = Transformation.identity()
2310
+ >>> transformed = point.apply_transformation(transformation)
2311
+ """
2312
+ def as_vector(self) -> numpy.ndarray[numpy.float64[3, 1]]:
2313
+ """
2314
+ Convert the point to a 3D vector.
2315
+
2316
+ Returns:
2317
+ Vector3d: The point as a 3D vector.
2318
+
2319
+ Example:
2320
+ >>> point = Point(1.0, 2.0, 3.0)
2321
+ >>> vector = point.as_vector() # np.array([1.0, 2.0, 3.0])
2322
+ """
2323
+ def distance_to(self, point: Point) -> ostk.core.type.Real:
2324
+ """
2325
+ Calculate the distance to another point.
2326
+
2327
+ Args:
2328
+ point (Point): The other point.
2329
+
2330
+ Returns:
2331
+ float: The distance between the points.
2332
+
2333
+ Example:
2334
+ >>> point1 = Point(0.0, 0.0, 0.0)
2335
+ >>> point2 = Point(3.0, 4.0, 0.0)
2336
+ >>> point1.distance_to(point2) # 5.0
2337
+ """
2338
+ def is_defined(self) -> bool:
2339
+ """
2340
+ Check if the point is defined.
2341
+
2342
+ Returns:
2343
+ bool: True if the point is defined, False otherwise.
2344
+
2345
+ Example:
2346
+ >>> point = Point(1.0, 2.0, 3.0)
2347
+ >>> point.is_defined() # True
2348
+ """
2349
+ def is_near(self, point: Point, tolerance: ostk.core.type.Real) -> bool:
2350
+ """
2351
+ Check if this point is near another point within tolerance.
2352
+
2353
+ Args:
2354
+ point (Point): The point to compare with.
2355
+ tolerance (float): The tolerance for comparison.
2356
+
2357
+ Returns:
2358
+ bool: True if points are within tolerance, False otherwise.
2359
+
2360
+ Example:
2361
+ >>> point1 = Point(1.0, 2.0, 3.0)
2362
+ >>> point2 = Point(1.1, 2.1, 3.1)
2363
+ >>> point1.is_near(point2, 0.2) # True
2364
+ """
2365
+ def to_string(self, precision: ostk.core.type.Integer = ...) -> ostk.core.type.String:
2366
+ """
2367
+ Convert the point to a string representation.
2368
+
2369
+ Args:
2370
+ precision (int, optional): Number of decimal places. Defaults to DEFAULT_PRECISION.
2371
+
2372
+ Returns:
2373
+ str: String representation of the point.
2374
+
2375
+ Example:
2376
+ >>> point = Point(1.123456, 2.345678, 3.567890)
2377
+ >>> point.to_string(3) # "[1.123, 2.346, 3.568]"
2378
+ """
2379
+ def x(self) -> ostk.core.type.Real:
2380
+ """
2381
+ Get the x-coordinate of the point.
2382
+
2383
+ Returns:
2384
+ float: The x-coordinate.
2385
+
2386
+ Example:
2387
+ >>> point = Point(1.0, 2.0, 3.0)
2388
+ >>> point.x() # 1.0
2389
+ """
2390
+ def y(self) -> ostk.core.type.Real:
2391
+ """
2392
+ Get the y-coordinate of the point.
2393
+
2394
+ Returns:
2395
+ float: The y-coordinate.
2396
+
2397
+ Example:
2398
+ >>> point = Point(1.0, 2.0, 3.0)
2399
+ >>> point.y() # 2.0
2400
+ """
2401
+ def z(self) -> ostk.core.type.Real:
2402
+ """
2403
+ Get the z-coordinate of the point.
2404
+
2405
+ Returns:
2406
+ float: The z-coordinate.
2407
+
2408
+ Example:
2409
+ >>> point = Point(1.0, 2.0, 3.0)
2410
+ >>> point.z() # 3.0
2411
+ """
2412
+ class PointSet(ostk.mathematics.geometry.d3.Object):
2413
+ """
2414
+
2415
+ A collection of 3D points.
2416
+
2417
+ A PointSet is an unordered collection of unique points in 3D space.
2418
+
2419
+ """
2420
+ __hash__: typing.ClassVar[None] = None
2421
+ @staticmethod
2422
+ def empty() -> PointSet:
2423
+ """
2424
+ Create an empty point set.
2425
+
2426
+ Returns:
2427
+ PointSet: An empty point set.
2428
+
2429
+ Example:
2430
+ >>> empty_set = PointSet.empty()
2431
+ >>> empty_set.is_empty() # True
2432
+ >>> empty_set.get_size() # 0
2433
+ """
2434
+ def __eq__(self, arg0: PointSet) -> bool:
2435
+ ...
2436
+ def __getitem__(self, arg0: int) -> Point:
2437
+ ...
2438
+ def __init__(self, points: list[Point]) -> None:
2439
+ """
2440
+ Construct a point set from an array of points.
2441
+
2442
+ Args:
2443
+ points (list[Point]): Array of 3D points.
2444
+
2445
+ Example:
2446
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
2447
+ >>> point_set = PointSet(points)
2448
+ >>> point_set.is_defined() # True
2449
+ """
2450
+ def __iter__(self) -> typing.Iterator[Point]:
2451
+ ...
2452
+ def __len__(self) -> int:
2453
+ ...
2454
+ def __ne__(self, arg0: PointSet) -> bool:
2455
+ ...
2456
+ def __repr__(self) -> str:
2457
+ ...
2458
+ def __str__(self) -> str:
2459
+ ...
2460
+ def apply_transformation(self, transformation: typing.Any) -> None:
2461
+ """
2462
+ Apply a transformation to all points in the set.
2463
+
2464
+ Args:
2465
+ transformation (Transformation): The transformation to apply.
2466
+
2467
+ Example:
2468
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
2469
+ >>> point_set = PointSet(points)
2470
+ >>> transformation = Transformation.translation([1.0, 0.0])
2471
+ >>> point_set.apply_transformation(transformation)
2472
+ """
2473
+ def distance_to(self, point: Point) -> ostk.core.type.Real:
2474
+ """
2475
+ Calculate the minimum distance from the point set to a point.
2476
+
2477
+ Args:
2478
+ point (Point): The point to measure distance to.
2479
+
2480
+ Returns:
2481
+ float: The minimum distance to any point in the set.
2482
+
2483
+ Example:
2484
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
2485
+ >>> point_set = PointSet(points)
2486
+ >>> point_set.distance_to(Point(0.5, 0.5)) # 0.5
2487
+ """
2488
+ def get_point_closest_to(self, point: Point) -> Point:
2489
+ """
2490
+ Get the point in the set closest to a given point.
2491
+
2492
+ Args:
2493
+ point (Point): The reference point.
2494
+
2495
+ Returns:
2496
+ Point: The closest point in the set.
2497
+
2498
+ Example:
2499
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
2500
+ >>> point_set = PointSet(points)
2501
+ >>> point_set.get_point_closest_to(Point(0.5, 0.5)) # Point(0.5, 0.5)
2502
+ """
2503
+ def get_size(self) -> int:
2504
+ """
2505
+ Get the number of points in the set.
2506
+
2507
+ Returns:
2508
+ int: The number of points.
2509
+
2510
+ Example:
2511
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
2512
+ >>> point_set = PointSet(points)
2513
+ >>> point_set.get_size() # 2
2514
+ """
2515
+ def is_defined(self) -> bool:
2516
+ """
2517
+ Check if the point set is defined.
2518
+
2519
+ Returns:
2520
+ bool: True if the point set is defined.
2521
+
2522
+ Example:
2523
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
2524
+ >>> point_set = PointSet(points)
2525
+ >>> point_set.is_defined() # True
2526
+ """
2527
+ def is_empty(self) -> bool:
2528
+ """
2529
+ Check if the point set is empty.
2530
+
2531
+ Returns:
2532
+ bool: True if the point set contains no points.
2533
+ """
2534
+ def is_near(self, point_set: PointSet, tolerance: ostk.core.type.Real) -> bool:
2535
+ """
2536
+ Check if another point set is near this one within a tolerance.
2537
+
2538
+ Args:
2539
+ point_set (PointSet): The point set to compare against.
2540
+ tolerance (float): The maximum distance for points to be considered near.
2541
+
2542
+ Returns:
2543
+ bool: True if the point sets are near each other.
2544
+
2545
+ Example:
2546
+ >>> points = [Point(0.0, 0.0), Point(1.0, 1.0)]
2547
+ >>> point_set = PointSet(points)
2548
+ >>> point_set.is_near(PointSet(points), 0.1) # True
2549
+ """
2550
+ class Polygon(ostk.mathematics.geometry.d3.Object):
2551
+ """
2552
+
2553
+ A polygon in 3D space.
2554
+
2555
+ A Polygon is a planar figure defined by a 2D polygon and its position and orientation in 3D space.
2556
+
2557
+ """
2558
+ __hash__: typing.ClassVar[None] = None
2559
+ @staticmethod
2560
+ def undefined() -> Polygon:
2561
+ """
2562
+ Create an undefined polygon.
2563
+
2564
+ Returns:
2565
+ Polygon: An undefined polygon.
2566
+
2567
+ Example:
2568
+ >>> undefined_polygon = Polygon.undefined()
2569
+ >>> undefined_polygon.is_defined() # False
2570
+ """
2571
+ def __eq__(self, arg0: Polygon) -> bool:
2572
+ ...
2573
+ def __init__(self, polygon: ostk.mathematics.geometry.d2.object.Polygon, origin: Point, x_axis: numpy.ndarray[numpy.float64[3, 1]], y_axis: numpy.ndarray[numpy.float64[3, 1]]) -> None:
2574
+ """
2575
+ Construct a 3D polygon from a 2D polygon and coordinate frame.
2576
+
2577
+ Args:
2578
+ polygon (Polygon2d): The 2D polygon.
2579
+ origin (Point): The origin of the polygon in 3D space.
2580
+ x_axis (numpy.ndarray): The x-axis direction of the polygon's local frame.
2581
+ y_axis (numpy.ndarray): The y-axis direction of the polygon's local frame.
2582
+
2583
+ Example:
2584
+ >>> polygon2d = Polygon2d([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2585
+ >>> origin = Point(0.0, 0.0, 0.0)
2586
+ >>> x_axis = np.array([1.0, 0.0, 0.0])
2587
+ >>> y_axis = np.array([0.0, 1.0, 0.0])
2588
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2589
+ """
2590
+ def __ne__(self, arg0: Polygon) -> bool:
2591
+ ...
2592
+ def __repr__(self) -> str:
2593
+ ...
2594
+ def __str__(self) -> str:
2595
+ ...
2596
+ def apply_transformation(self, transformation: typing.Any) -> None:
2597
+ """
2598
+ Apply a transformation to the polygon in place.
2599
+
2600
+ Args:
2601
+ transformation (Transformation): The transformation to apply.
2602
+
2603
+ Example:
2604
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2605
+ >>> transformation = Transformation.identity()
2606
+ >>> polygon.apply_transformation(transformation)
2607
+ """
2608
+ def get_edge_at(self, index: int) -> Segment:
2609
+ """
2610
+ Get the edge at a given index.
2611
+
2612
+ Args:
2613
+ index (int): The index of the edge.
2614
+
2615
+ Returns:
2616
+ Segment: The edge segment.
2617
+
2618
+ Example:
2619
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2620
+ >>> polygon.get_edge_at(0)
2621
+ """
2622
+ def get_edge_count(self) -> int:
2623
+ """
2624
+ Get the number of edges in the polygon.
2625
+
2626
+ Returns:
2627
+ int: The number of edges.
2628
+
2629
+ Example:
2630
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2631
+ >>> polygon.get_edge_count()
2632
+ """
2633
+ def get_normal_vector(self) -> numpy.ndarray[numpy.float64[3, 1]]:
2634
+ """
2635
+ Get the normal vector of the polygon's plane.
2636
+
2637
+ Returns:
2638
+ numpy.ndarray: The normal vector.
2639
+
2640
+ Example:
2641
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2642
+ >>> polygon.get_normal_vector()
2643
+ """
2644
+ def get_origin(self) -> Point:
2645
+ """
2646
+ Get the origin point of the polygon.
2647
+
2648
+ Returns:
2649
+ Point: The origin point.
2650
+
2651
+ Example:
2652
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2653
+ >>> polygon.get_origin()
2654
+ """
2655
+ def get_polygon2d(self) -> ostk.mathematics.geometry.d2.object.Polygon:
2656
+ """
2657
+ Get the 2D polygon representation.
2658
+
2659
+ Returns:
2660
+ Polygon2d: The 2D polygon.
2661
+
2662
+ Example:
2663
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2664
+ >>> polygon.get_polygon2d()
2665
+ """
2666
+ def get_vertex_at(self, index: int) -> Point:
2667
+ """
2668
+ Get the vertex at a given index.
2669
+
2670
+ Args:
2671
+ index (int): The index of the vertex.
2672
+
2673
+ Returns:
2674
+ Point: The vertex point.
2675
+
2676
+ Example:
2677
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2678
+ >>> polygon.get_vertex_at(0)
2679
+ """
2680
+ def get_vertex_count(self) -> int:
2681
+ """
2682
+ Get the number of vertices in the polygon.
2683
+
2684
+ Returns:
2685
+ int: The number of vertices.
2686
+
2687
+ Example:
2688
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2689
+ >>> polygon.get_vertex_count()
2690
+ """
2691
+ def get_vertices(self) -> list[Point]:
2692
+ """
2693
+ Get all vertices of the polygon.
2694
+
2695
+ Returns:
2696
+ list[Point]: Array of vertex points.
2697
+
2698
+ Example:
2699
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2700
+ >>> polygon.get_vertices()
2701
+ """
2702
+ def get_x_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
2703
+ """
2704
+ Get the x-axis direction of the polygon's local frame.
2705
+
2706
+ Returns:
2707
+ numpy.ndarray: The x-axis vector.
2708
+
2709
+ Example:
2710
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2711
+ >>> polygon.get_x_axis()
2712
+ """
2713
+ def get_y_axis(self) -> numpy.ndarray[numpy.float64[3, 1]]:
2714
+ """
2715
+ Get the y-axis direction of the polygon's local frame.
2716
+
2717
+ Returns:
2718
+ numpy.ndarray: The y-axis vector.
2719
+
2720
+ Example:
2721
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2722
+ >>> polygon.get_y_axis()
2723
+ """
2724
+ def is_defined(self) -> bool:
2725
+ """
2726
+ Check if the polygon is defined.
2727
+
2728
+ Returns:
2729
+ bool: True if the polygon is defined.
2730
+
2731
+ Example:
2732
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2733
+ >>> polygon.is_defined()
2734
+ """
2735
+ def is_near(self, polygon: Polygon, tolerance: ostk.core.type.Real) -> bool:
2736
+ """
2737
+ Check if another polygon is near this one within a tolerance.
2738
+
2739
+ Args:
2740
+ polygon (Polygon): The polygon to compare against.
2741
+ tolerance (float): The maximum distance for polygons to be considered near.
2742
+
2743
+ Returns:
2744
+ bool: True if the polygons are near each other.
2745
+
2746
+ Example:
2747
+ >>> polygon = Polygon(polygon2d, origin, x_axis, y_axis)
2748
+ >>> polygon.is_near(polygon, 0.0)
2749
+ """
2750
+ class Pyramid(ostk.mathematics.geometry.d3.Object):
2751
+ """
2752
+
2753
+ A pyramid in 3D space.
2754
+
2755
+ A Pyramid is defined by a polygonal base and an apex point, with triangular lateral faces connecting the base edges to the apex.
2756
+
2757
+ """
2758
+ __hash__: typing.ClassVar[None] = None
2759
+ @staticmethod
2760
+ def undefined() -> Pyramid:
2761
+ """
2762
+ Create an undefined pyramid.
2763
+
2764
+ Returns:
2765
+ Pyramid: An undefined pyramid.
2766
+
2767
+ Example:
2768
+ >>> undefined_pyramid = Pyramid.undefined()
2769
+ >>> undefined_pyramid.is_defined() # False
2770
+ """
2771
+ def __eq__(self, arg0: Pyramid) -> bool:
2772
+ ...
2773
+ def __init__(self, base: Polygon, apex: Point) -> None:
2774
+ """
2775
+ Construct a pyramid from a base polygon and apex point.
2776
+
2777
+ Args:
2778
+ base (Polygon): The polygonal base of the pyramid.
2779
+ apex (Point): The apex point of the pyramid.
2780
+
2781
+ Example:
2782
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2783
+ >>> apex = Point(0.0, 0.0, 1.0)
2784
+ >>> pyramid = Pyramid(base, apex)
2785
+ """
2786
+ def __ne__(self, arg0: Pyramid) -> bool:
2787
+ ...
2788
+ def __repr__(self) -> str:
2789
+ ...
2790
+ def __str__(self) -> str:
2791
+ ...
2792
+ def apply_transformation(self, transformation: typing.Any) -> None:
2793
+ """
2794
+ Apply a transformation to the pyramid.
2795
+
2796
+ Args:
2797
+ transformation (Transformation): The transformation to apply.
2798
+
2799
+ Example:
2800
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2801
+ >>> apex = Point(0.0, 0.0, 1.0)
2802
+ >>> pyramid = Pyramid(base, apex)
2803
+ >>> transformation = Transformation.identity()
2804
+ >>> pyramid.apply_transformation(transformation)
2805
+ """
2806
+ @typing.overload
2807
+ def contains(self, point: Point) -> bool:
2808
+ """
2809
+ Check if the pyramid contains a point.
2810
+
2811
+ Args:
2812
+ point (Point): The point to check.
2813
+
2814
+ Returns:
2815
+ bool: True if the pyramid contains the point.
2816
+
2817
+ Example:
2818
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2819
+ >>> apex = Point(0.0, 0.0, 1.0)
2820
+ >>> pyramid = Pyramid(base, apex)
2821
+ >>> pyramid.contains(Point(0.5, 0.5, 0.5))
2822
+ """
2823
+ @typing.overload
2824
+ def contains(self, point_set: PointSet) -> bool:
2825
+ """
2826
+ Check if the pyramid contains all points in a point set.
2827
+
2828
+ Args:
2829
+ point_set (PointSet): The point set to check.
2830
+
2831
+ Returns:
2832
+ bool: True if the pyramid contains all points.
2833
+
2834
+ Example:
2835
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2836
+ >>> apex = Point(0.0, 0.0, 1.0)
2837
+ >>> pyramid = Pyramid(base, apex)
2838
+ >>> pyramid.contains(PointSet([Point(0.5, 0.5, 0.5), Point(0.6, 0.6, 0.6)]))
2839
+ """
2840
+ @typing.overload
2841
+ def contains(self, segment: Segment) -> bool:
2842
+ """
2843
+ Check if the pyramid contains a segment.
2844
+
2845
+ Args:
2846
+ segment (Segment): The segment to check.
2847
+
2848
+ Returns:
2849
+ bool: True if the pyramid contains the segment.
2850
+
2851
+ Example:
2852
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2853
+ >>> apex = Point(0.0, 0.0, 1.0)
2854
+ >>> pyramid = Pyramid(base, apex)
2855
+ >>> pyramid.contains(Segment(Point(0.5, 0.5, 0.5), Point(0.6, 0.6, 0.6)))
2856
+ """
2857
+ @typing.overload
2858
+ def contains(self, ellipsoid: Ellipsoid) -> bool:
2859
+ """
2860
+ Check if the pyramid contains an ellipsoid.
2861
+
2862
+ Args:
2863
+ ellipsoid (Ellipsoid): The ellipsoid to check.
2864
+
2865
+ Returns:
2866
+ bool: True if the pyramid contains the ellipsoid.
2867
+
2868
+ Example:
2869
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2870
+ >>> apex = Point(0.0, 0.0, 1.0)
2871
+ >>> pyramid = Pyramid(base, apex)
2872
+ >>> pyramid.contains(Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 1.0, 1.0))
2873
+ """
2874
+ def get_apex(self) -> Point:
2875
+ """
2876
+ Get the apex point of the pyramid.
2877
+
2878
+ Returns:
2879
+ Point: The apex point.
2880
+
2881
+ Example:
2882
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2883
+ >>> apex = Point(0.0, 0.0, 1.0)
2884
+ >>> pyramid = Pyramid(base, apex)
2885
+ >>> pyramid.get_apex()
2886
+ """
2887
+ def get_base(self) -> Polygon:
2888
+ """
2889
+ Get the base polygon of the pyramid.
2890
+
2891
+ Returns:
2892
+ Polygon: The base polygon.
2893
+
2894
+ Example:
2895
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2896
+ >>> apex = Point(0.0, 0.0, 1.0)
2897
+ >>> pyramid = Pyramid(base, apex)
2898
+ >>> pyramid.get_base()
2899
+ """
2900
+ def get_lateral_face_at(self, index: int) -> Polygon:
2901
+ """
2902
+ Get the lateral face at a given index.
2903
+
2904
+ Args:
2905
+ index (int): The index of the lateral face.
2906
+
2907
+ Returns:
2908
+ Polygon: The lateral face polygon.
2909
+
2910
+ Example:
2911
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2912
+ >>> apex = Point(0.0, 0.0, 1.0)
2913
+ >>> pyramid = Pyramid(base, apex)
2914
+ >>> pyramid.get_lateral_face_at(0)
2915
+ """
2916
+ def get_lateral_face_count(self) -> int:
2917
+ """
2918
+ Get the number of lateral faces.
2919
+
2920
+ Returns:
2921
+ int: The number of lateral faces.
2922
+
2923
+ Example:
2924
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2925
+ >>> apex = Point(0.0, 0.0, 1.0)
2926
+ >>> pyramid = Pyramid(base, apex)
2927
+ >>> pyramid.get_lateral_face_count()
2928
+ """
2929
+ def get_rays_of_lateral_face_at(self, lateral_face_index: int, ray_count: int = 2) -> list[Ray]:
2930
+ """
2931
+ Get rays from the apex through a specific lateral face.
2932
+
2933
+ Args:
2934
+ lateral_face_index (int): The index of the lateral face.
2935
+ ray_count (int): The number of rays to generate (default: 2).
2936
+
2937
+ Returns:
2938
+ list[Ray]: Array of rays.
2939
+
2940
+ Example:
2941
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2942
+ >>> apex = Point(0.0, 0.0, 1.0)
2943
+ >>> pyramid = Pyramid(base, apex)
2944
+ >>> pyramid.get_rays_of_lateral_face_at(0)
2945
+ """
2946
+ def get_rays_of_lateral_faces(self, ray_count: int = 0) -> list[Ray]:
2947
+ """
2948
+ Get rays from the apex through all lateral faces.
2949
+
2950
+ Args:
2951
+ ray_count (int, optional): The number of rays per face. Defaults to 0.
2952
+
2953
+ Returns:
2954
+ list[Ray]: Array of rays.
2955
+
2956
+ Example:
2957
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2958
+ >>> apex = Point(0.0, 0.0, 1.0)
2959
+ >>> pyramid = Pyramid(base, apex)
2960
+ >>> pyramid.get_rays_of_lateral_faces(ray_count=1)
2961
+ """
2962
+ @typing.overload
2963
+ def intersection_with(self, sphere: Sphere, only_in_sight: bool = False, discretization_level: int = 40) -> ...:
2964
+ """
2965
+ Compute the intersection of the pyramid with a sphere.
2966
+
2967
+ Args:
2968
+ sphere (Sphere): The sphere to intersect with.
2969
+ only_in_sight (bool): Only compute intersection in sight of the apex.
2970
+ discretization_level (int): The level of discretization for the computation.
2971
+
2972
+ Returns:
2973
+ Intersection: The intersection result.
2974
+
2975
+ Example:
2976
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2977
+ >>> apex = Point(0.0, 0.0, 1.0)
2978
+ >>> pyramid = Pyramid(base, apex)
2979
+ >>> pyramid.intersection_with(Sphere(Point(0.0, 0.0, 0.0), 1.0))
2980
+ """
2981
+ @typing.overload
2982
+ def intersection_with(self, ellipsoid: Ellipsoid, only_in_sight: bool = False, discretization_level: int = 40) -> ...:
2983
+ """
2984
+ Compute the intersection of the pyramid with an ellipsoid.
2985
+
2986
+ Args:
2987
+ ellipsoid (Ellipsoid): The ellipsoid to intersect with.
2988
+ only_in_sight (bool): Only compute intersection in sight of the apex.
2989
+ discretization_level (int): The level of discretization for the computation.
2990
+
2991
+ Returns:
2992
+ Intersection: The intersection result.
2993
+
2994
+ Example:
2995
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
2996
+ >>> apex = Point(0.0, 0.0, 1.0)
2997
+ >>> pyramid = Pyramid(base, apex)
2998
+ >>> pyramid.intersection_with(Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 1.0, 1.0))
2999
+ """
3000
+ def intersects(self, ellipsoid: Ellipsoid, discretization_level: int = 40) -> bool:
3001
+ """
3002
+ Check if the pyramid intersects an ellipsoid.
3003
+
3004
+ Args:
3005
+ ellipsoid (Ellipsoid): The ellipsoid to check intersection with.
3006
+ discretization_level (int): The level of discretization for the check.
3007
+
3008
+ Returns:
3009
+ bool: True if the pyramid intersects the ellipsoid.
3010
+ """
3011
+ def is_defined(self) -> bool:
3012
+ """
3013
+ Check if the pyramid is defined.
3014
+
3015
+ Returns:
3016
+ bool: True if the pyramid is defined.
3017
+
3018
+ Example:
3019
+ >>> base = Polygon([Point2d(0.0, 0.0), Point2d(1.0, 0.0), Point2d(1.0, 1.0), Point2d(0.0, 1.0)])
3020
+ >>> apex = Point(0.0, 0.0, 1.0)
3021
+ >>> pyramid = Pyramid(base, apex)
3022
+ >>> pyramid.is_defined()
3023
+ """
3024
+ class Ray(ostk.mathematics.geometry.d3.Object):
3025
+ __hash__: typing.ClassVar[None] = None
3026
+ @staticmethod
3027
+ def undefined() -> Ray:
3028
+ """
3029
+ Create an undefined ray.
3030
+
3031
+ Returns:
3032
+ Ray: An undefined ray object.
3033
+
3034
+ Example:
3035
+ >>> undefined_ray = Ray.undefined()
3036
+ >>> undefined_ray.is_defined() # False
3037
+ """
3038
+ def __eq__(self, arg0: Ray) -> bool:
3039
+ ...
3040
+ def __init__(self, origin: Point, direction: numpy.ndarray[numpy.float64[3, 1]]) -> None:
3041
+ """
3042
+ Create a 3D ray with specified origin and direction.
3043
+
3044
+ Args:
3045
+ origin (Point): The origin point of the ray.
3046
+ direction (np.array): The direction vector of the ray.
3047
+
3048
+ Example:
3049
+ >>> origin = Point(0.0, 0.0, 0.0)
3050
+ >>> direction = np.array([1.0, 0.0, 0.0])
3051
+ >>> ray = Ray(origin, direction)
3052
+ """
3053
+ def __ne__(self, arg0: Ray) -> bool:
3054
+ ...
3055
+ def __repr__(self) -> str:
3056
+ ...
3057
+ def __str__(self) -> str:
3058
+ ...
3059
+ def apply_transformation(self, transformation: typing.Any) -> None:
3060
+ """
3061
+ Apply a transformation to the ray.
3062
+
3063
+ Args:
3064
+ transformation (Transformation): The transformation to apply.
3065
+
3066
+ Example:
3067
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
3068
+ >>> transformation = Transformation.translation([1.0, 0.0])
3069
+ >>> ray.apply_transformation(transformation)
3070
+ """
3071
+ @typing.overload
3072
+ def contains(self, point: Point) -> bool:
3073
+ """
3074
+ Check if the ray contains a point.
3075
+
3076
+ Args:
3077
+ point (Point): The point to check.
3078
+
3079
+ Returns:
3080
+ bool: True if the ray contains the point, False otherwise.
3081
+
3082
+ Example:
3083
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
3084
+ >>> ray.contains(Point(2.0, 0.0, 0.0)) # True (point on ray)
3085
+ """
3086
+ @typing.overload
3087
+ def contains(self, point_set: PointSet) -> bool:
3088
+ """
3089
+ Check if the ray contains a point set.
3090
+
3091
+ Args:
3092
+ point_set (PointSet): The point set to check.
3093
+
3094
+ Returns:
3095
+ bool: True if the ray contains the point set, False otherwise.
3096
+ """
3097
+ def distance_to(self, point: Point) -> ostk.core.type.Real:
3098
+ """
3099
+ Calculate the distance from the ray to a point.
3100
+
3101
+ Args:
3102
+ point (Point): The point to calculate distance to.
3103
+
3104
+ Returns:
3105
+ float: The minimum distance from the ray to the point.
3106
+
3107
+ Example:
3108
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
3109
+ >>> distance = ray.distance_to(Point(1.0, 1.0, 0.0)) # 1.0
3110
+ """
3111
+ def get_direction(self) -> numpy.ndarray[numpy.float64[3, 1]]:
3112
+ """
3113
+ Get the direction vector of the ray.
3114
+
3115
+ Returns:
3116
+ Vector3d: The normalized direction vector of the ray.
3117
+
3118
+ Example:
3119
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
3120
+ >>> direction = ray.get_direction() # [1.0, 0.0, 0.0]
3121
+ """
3122
+ def get_origin(self) -> Point:
3123
+ """
3124
+ Get the origin point of the ray.
3125
+
3126
+ Returns:
3127
+ Point: The origin point of the ray.
3128
+
3129
+ Example:
3130
+ >>> ray = Ray(Point(1.0, 2.0, 3.0), np.array([1.0, 0.0, 0.0]))
3131
+ >>> origin = ray.get_origin() # Point(1.0, 2.0, 3.0)
3132
+ """
3133
+ @typing.overload
3134
+ def intersection_with(self, plane: typing.Any) -> ...:
3135
+ """
3136
+ Compute the intersection of the ray with a plane.
3137
+
3138
+ Args:
3139
+ plane (Plane): The plane to intersect with.
3140
+
3141
+ Returns:
3142
+ Intersection: The intersection of the ray with the plane.
3143
+
3144
+ Example:
3145
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, -1.0]))
3146
+ >>> plane = Plane(Point(0.0, 0.0, 0.0), np.array([0.0, 0.0, 1.0]))
3147
+ >>> intersection = ray.intersection_with(plane)
3148
+ >>> intersection.get_point() # Point(0.0, 0.0, 0.0)
3149
+ """
3150
+ @typing.overload
3151
+ def intersection_with(self, sphere: typing.Any, only_in_sight: bool = False) -> ...:
3152
+ """
3153
+ Compute the intersection of the ray with a sphere.
3154
+
3155
+ Args:
3156
+ sphere (Sphere): The sphere to intersect with.
3157
+ only_in_sight (bool, optional): If true, only return intersection points that are in sight. Defaults to True.
3158
+
3159
+ Returns:
3160
+ Intersection: The intersection of the ray with the sphere.
3161
+
3162
+ Example:
3163
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
3164
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3165
+ >>> intersection = ray.intersection_with(sphere)
3166
+ >>> intersection.get_point() # Point(0.0, 0.0, 0.0)
3167
+ """
3168
+ @typing.overload
3169
+ def intersection_with(self, ellipsoid: typing.Any, only_in_sight: bool = False) -> ...:
3170
+ """
3171
+ Compute the intersection of the ray with an ellipsoid.
3172
+
3173
+ Args:
3174
+ ellipsoid (Ellipsoid): The ellipsoid to intersect with.
3175
+ only_in_sight (bool, optional): If true, only return intersection points that are in sight. Defaults to True.
3176
+
3177
+ Returns:
3178
+ Intersection: The intersection of the ray with the ellipsoid.
3179
+
3180
+ Example:
3181
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
3182
+ >>> ellipsoid = Ellipsoid(Point(0.0, 0.0, 0.0), 1.0, 1.0, 1.0)
3183
+ >>> intersection = ray.intersection_with(ellipsoid)
3184
+ >>> intersection.get_point() # Point(0.0, 0.0, 0.0)
3185
+ """
3186
+ @typing.overload
3187
+ def intersects(self, point: Point) -> bool:
3188
+ ...
3189
+ @typing.overload
3190
+ def intersects(self, plane: typing.Any) -> bool:
3191
+ ...
3192
+ @typing.overload
3193
+ def intersects(self, sphere: typing.Any) -> bool:
3194
+ ...
3195
+ @typing.overload
3196
+ def intersects(self, ellipsoid: typing.Any) -> bool:
3197
+ ...
3198
+ def is_defined(self) -> bool:
3199
+ """
3200
+ Check if the ray is defined.
3201
+
3202
+ Returns:
3203
+ bool: True if the ray is defined, False otherwise.
3204
+
3205
+ Example:
3206
+ >>> ray = Ray(Point(0.0, 0.0, 0.0), np.array([1.0, 0.0, 0.0]))
3207
+ >>> ray.is_defined() # True
3208
+ """
3209
+ class Segment(ostk.mathematics.geometry.d3.Object):
3210
+ __hash__: typing.ClassVar[None] = None
3211
+ @staticmethod
3212
+ def undefined() -> Segment:
3213
+ """
3214
+ Create an undefined segment.
3215
+
3216
+ Returns:
3217
+ Segment: An undefined segment object.
3218
+
3219
+ Example:
3220
+ >>> undefined_segment = Segment.undefined()
3221
+ >>> undefined_segment.is_defined() # False
3222
+ """
3223
+ def __eq__(self, arg0: Segment) -> bool:
3224
+ ...
3225
+ def __init__(self, first_point: Point, second_point: Point) -> None:
3226
+ """
3227
+ Create a 3D segment between two points.
3228
+
3229
+ Args:
3230
+ first_point (Point): The first endpoint of the segment.
3231
+ second_point (Point): The second endpoint of the segment.
3232
+
3233
+ Example:
3234
+ >>> point1 = Point(0.0, 0.0, 0.0)
3235
+ >>> point2 = Point(1.0, 1.0, 1.0)
3236
+ >>> segment = Segment(point1, point2)
3237
+ """
3238
+ def __ne__(self, arg0: Segment) -> bool:
3239
+ ...
3240
+ def __repr__(self) -> str:
3241
+ ...
3242
+ def __str__(self) -> str:
3243
+ ...
3244
+ def apply_transformation(self, transformation: typing.Any) -> None:
3245
+ """
3246
+ Apply a transformation to the segment in place.
3247
+
3248
+ Args:
3249
+ transformation (Transformation): The transformation to apply.
3250
+
3251
+ Example:
3252
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
3253
+ >>> transformation = Translation([1.0, 1.0, 1.0])
3254
+ >>> segment.apply_transformation(transformation)
3255
+ """
3256
+ def contains(self, point: Point) -> bool:
3257
+ """
3258
+ Check if the segment contains a point.
3259
+
3260
+ Args:
3261
+ point (Point): The point to check.
3262
+
3263
+ Returns:
3264
+ bool: True if the segment contains the point, False otherwise.
3265
+
3266
+ Example:
3267
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0))
3268
+ >>> segment.contains(Point(1.0, 0.0, 0.0)) # True (midpoint)
3269
+ """
3270
+ @typing.overload
3271
+ def distance_to(self, point: Point) -> ostk.core.type.Real:
3272
+ """
3273
+ Calculate the distance from the segment to a point.
3274
+
3275
+ Args:
3276
+ point (Point): The point to calculate distance to.
3277
+
3278
+ Returns:
3279
+ float: The distance from the segment to the point.
3280
+
3281
+ Example:
3282
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0))
3283
+ >>> distance = segment.distance_to(Point(1.0, 0.0, 0.0)) # 1.0
3284
+ """
3285
+ @typing.overload
3286
+ def distance_to(self, point_set: PointSet) -> ostk.core.type.Real:
3287
+ """
3288
+ Calculate the distance from the segment to a point set.
3289
+
3290
+ Args:
3291
+ point_set (PointSet): The point set to calculate distance to.
3292
+
3293
+ Returns:
3294
+ float: The distance from the segment to the point set.
3295
+
3296
+ Example:
3297
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0))
3298
+ >>> points = PointSet([Point(1.0, 0.0, 0.0), Point(3.0, 0.0, 0.0)])
3299
+ >>> distance = segment.distance_to(points) # 1.0
3300
+ """
3301
+ def get_center(self) -> Point:
3302
+ """
3303
+ Get the center point of the segment.
3304
+
3305
+ Returns:
3306
+ Point: The midpoint of the segment.
3307
+
3308
+ Example:
3309
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 2.0, 2.0))
3310
+ >>> center = segment.get_center() # Point(1.0, 1.0, 1.0)
3311
+ """
3312
+ def get_direction(self) -> numpy.ndarray[numpy.float64[3, 1]]:
3313
+ """
3314
+ Get the direction vector of the segment.
3315
+
3316
+ Returns:
3317
+ Vector3d: The normalized direction vector from first to second point.
3318
+
3319
+ Example:
3320
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 0.0, 0.0))
3321
+ >>> direction = segment.get_direction() # [1.0, 0.0, 0.0]
3322
+ """
3323
+ def get_first_point(self) -> Point:
3324
+ """
3325
+ Get the first endpoint of the segment.
3326
+
3327
+ Returns:
3328
+ Point: The first endpoint of the segment.
3329
+
3330
+ Example:
3331
+ >>> segment = Segment(Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0))
3332
+ >>> first_point = segment.get_first_point() # Point(1.0, 2.0, 3.0)
3333
+ """
3334
+ def get_length(self) -> ostk.core.type.Real:
3335
+ """
3336
+ Get the length of the segment.
3337
+
3338
+ Returns:
3339
+ float: The distance between the two endpoints.
3340
+
3341
+ Example:
3342
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(3.0, 4.0, 0.0))
3343
+ >>> length = segment.get_length() # 5.0
3344
+ """
3345
+ def get_second_point(self) -> Point:
3346
+ """
3347
+ Get the second endpoint of the segment.
3348
+
3349
+ Returns:
3350
+ Point: The second endpoint of the segment.
3351
+
3352
+ Example:
3353
+ >>> segment = Segment(Point(1.0, 2.0, 3.0), Point(4.0, 5.0, 6.0))
3354
+ >>> second_point = segment.get_second_point() # Point(4.0, 5.0, 6.0)
3355
+ """
3356
+ def intersection_with(self, plane: typing.Any) -> ...:
3357
+ """
3358
+ Calculate the intersection of the segment with a plane.
3359
+
3360
+ Args:
3361
+ plane (Plane): The plane to calculate intersection with.
3362
+
3363
+ Returns:
3364
+ Intersection: The intersection of the segment with the plane.
3365
+
3366
+ Example:
3367
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0))
3368
+ >>> plane = Plane(Point(1.0, 0.0, 0.0), Vector3d(0.0, 0.0, 1.0))
3369
+ >>> intersection = segment.intersection_with(plane)
3370
+ >>> intersection.get_point() # Point(1.0, 0.0, 0.0)
3371
+ """
3372
+ @typing.overload
3373
+ def intersects(self, plane: typing.Any) -> bool:
3374
+ """
3375
+ Check if the segment intersects a plane.
3376
+
3377
+ Args:
3378
+ plane (Plane): The plane to check intersection with.
3379
+
3380
+ Returns:
3381
+ bool: True if the segment intersects the plane.
3382
+
3383
+ Example:
3384
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0))
3385
+ >>> segment.intersects(Plane(Point(1.0, 0.0, 0.0), Vector3d(0.0, 0.0, 1.0))) # True
3386
+ """
3387
+ @typing.overload
3388
+ def intersects(self, sphere: typing.Any) -> bool:
3389
+ """
3390
+ Check if the segment intersects a sphere.
3391
+
3392
+ Args:
3393
+ sphere (Sphere): The sphere to check intersection with.
3394
+
3395
+ Returns:
3396
+ bool: True if the segment intersects the sphere.
3397
+
3398
+ Example:
3399
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0))
3400
+ >>> segment.intersects(Sphere(Point(1.0, 0.0, 0.0), 1.0)) # True
3401
+ """
3402
+ @typing.overload
3403
+ def intersects(self, ellipsoid: typing.Any) -> bool:
3404
+ """
3405
+ Check if the segment intersects an ellipsoid.
3406
+
3407
+ Args:
3408
+ ellipsoid (Ellipsoid): The ellipsoid to check intersection with.
3409
+
3410
+ Returns:
3411
+ bool: True if the segment intersects the ellipsoid.
3412
+
3413
+ Example:
3414
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(2.0, 0.0, 0.0))
3415
+ >>> segment.intersects(Ellipsoid(Point(1.0, 0.0, 0.0), 1.0, 1.0, 1.0)) # True
3416
+ """
3417
+ def is_defined(self) -> bool:
3418
+ """
3419
+ Check if the segment is defined.
3420
+
3421
+ Returns:
3422
+ bool: True if the segment is defined, False otherwise.
3423
+
3424
+ Example:
3425
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
3426
+ >>> segment.is_defined() # True
3427
+ """
3428
+ def is_degenerate(self) -> bool:
3429
+ """
3430
+ Check if the segment is degenerate (both endpoints are the same).
3431
+
3432
+ Returns:
3433
+ bool: True if the segment is degenerate, False otherwise.
3434
+
3435
+ Example:
3436
+ >>> point = Point(0.0, 0.0, 0.0)
3437
+ >>> degenerate_segment = Segment(point, point)
3438
+ >>> degenerate_segment.is_degenerate() # True
3439
+ """
3440
+ def to_line(self) -> Line:
3441
+ """
3442
+ Convert the segment to a line.
3443
+
3444
+ Returns:
3445
+ Line: A line passing through the segment's endpoints.
3446
+
3447
+ Example:
3448
+ >>> segment = Segment(Point(0.0, 0.0, 0.0), Point(1.0, 1.0, 1.0))
3449
+ >>> line = segment.to_line()
3450
+ """
3451
+ class Sphere(ostk.mathematics.geometry.d3.Object):
3452
+ __hash__: typing.ClassVar[None] = None
3453
+ @staticmethod
3454
+ def undefined() -> Sphere:
3455
+ """
3456
+ Create an undefined sphere.
3457
+
3458
+ Returns:
3459
+ Sphere: An undefined sphere.
3460
+
3461
+ Example:
3462
+ >>> undefined_sphere = Sphere.undefined()
3463
+ >>> undefined_sphere.is_defined() # False
3464
+ """
3465
+ @staticmethod
3466
+ def unit(center: Point) -> Sphere:
3467
+ """
3468
+ Create a unit sphere (radius = 1) at a given center.
3469
+
3470
+ Args:
3471
+ center (Point): The center point of the unit sphere.
3472
+
3473
+ Returns:
3474
+ Sphere: A unit sphere centered at the given point.
3475
+
3476
+ Example:
3477
+ >>> center = Point(1.0, 2.0, 3.0)
3478
+ >>> unit_sphere = Sphere.unit(center)
3479
+ >>> unit_sphere.get_radius() # 1.0
3480
+ """
3481
+ def __eq__(self, arg0: Sphere) -> bool:
3482
+ ...
3483
+ def __init__(self, center: Point, radius: ostk.core.type.Real) -> None:
3484
+ """
3485
+ Create a 3D sphere with center and radius.
3486
+
3487
+ Args:
3488
+ center (Point): The center point of the sphere.
3489
+ radius (float): The radius of the sphere.
3490
+
3491
+ Example:
3492
+ >>> center = Point(0.0, 0.0, 0.0)
3493
+ >>> sphere = Sphere(center, 1.0)
3494
+ """
3495
+ def __ne__(self, arg0: Sphere) -> bool:
3496
+ ...
3497
+ def __repr__(self) -> str:
3498
+ ...
3499
+ def __str__(self) -> str:
3500
+ ...
3501
+ def apply_transformation(self, transformation: typing.Any) -> None:
3502
+ """
3503
+ Apply a transformation to the sphere in place.
3504
+
3505
+ Args:
3506
+ transformation (Transformation): The transformation to apply.
3507
+
3508
+ Example:
3509
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3510
+ >>> transformation = Translation([1.0, 0.0, 0.0])
3511
+ >>> sphere.apply_transformation(transformation)
3512
+ """
3513
+ @typing.overload
3514
+ def contains(self, point: Point) -> bool:
3515
+ """
3516
+ Check if the sphere contains a point.
3517
+
3518
+ Args:
3519
+ point (Point): The point to check.
3520
+
3521
+ Returns:
3522
+ bool: True if the sphere contains the point, False otherwise.
3523
+
3524
+ Example:
3525
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3526
+ >>> sphere.contains(Point(0.5, 0.5, 0.5)) # True
3527
+ """
3528
+ @typing.overload
3529
+ def contains(self, point_set: PointSet) -> bool:
3530
+ """
3531
+ Check if the sphere contains a point set.
3532
+
3533
+ Args:
3534
+ point_set (PointSet): The point set to check.
3535
+
3536
+ Returns:
3537
+ bool: True if the sphere contains the point set, False otherwise.
3538
+
3539
+ Example:
3540
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3541
+ >>> sphere.contains(PointSet([Point(0.5, 0.5, 0.5), Point(1.0, 1.0, 1.0)])) # True
3542
+ """
3543
+ def get_center(self) -> Point:
3544
+ """
3545
+ Get the center point of the sphere.
3546
+
3547
+ Returns:
3548
+ Point: The center point of the sphere.
3549
+
3550
+ Example:
3551
+ >>> sphere = Sphere(Point(1.0, 2.0, 3.0), 1.0)
3552
+ >>> center = sphere.get_center() # Point(1.0, 2.0, 3.0)
3553
+ """
3554
+ def get_radius(self) -> ostk.core.type.Real:
3555
+ """
3556
+ Get the radius of the sphere.
3557
+
3558
+ Returns:
3559
+ float: The radius of the sphere.
3560
+
3561
+ Example:
3562
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 2.5)
3563
+ >>> radius = sphere.get_radius() # 2.5
3564
+ """
3565
+ @typing.overload
3566
+ def intersection_with(self, line: Line) -> ...:
3567
+ """
3568
+ Check if the sphere intersects a line.
3569
+
3570
+ Args:
3571
+ line (Line): The line to check intersection with.
3572
+
3573
+ Returns:
3574
+ bool: True if the sphere intersects the line.
3575
+
3576
+ Example:
3577
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3578
+ >>> sphere.intersection_with(Line(Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0))) # True
3579
+ """
3580
+ @typing.overload
3581
+ def intersection_with(self, ray: Ray, only_in_sight: bool = False) -> ...:
3582
+ """
3583
+ Check if the sphere intersects a ray.
3584
+
3585
+ Args:
3586
+ ray (Ray): The ray to check intersection with.
3587
+ only_in_sight (bool, optional): If true, only return intersection points that are in sight. Defaults to False.
3588
+
3589
+ Returns:
3590
+ bool: True if the sphere intersects the ray.
3591
+
3592
+ Example:
3593
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3594
+ >>> sphere.intersection_with(Ray(Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0))) # True
3595
+ """
3596
+ @typing.overload
3597
+ def intersects(self, point: Point) -> bool:
3598
+ """
3599
+ Check if the sphere intersects a point.
3600
+
3601
+ Args:
3602
+ point (Point): The point to check intersection with.
3603
+
3604
+ Returns:
3605
+ bool: True if the sphere intersects the point.
3606
+
3607
+ Example:
3608
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3609
+ >>> sphere.intersects(Point(1.0, 0.0, 0.0)) # True
3610
+ """
3611
+ @typing.overload
3612
+ def intersects(self, point_set: PointSet) -> bool:
3613
+ """
3614
+ Check if the sphere intersects a point set.
3615
+
3616
+ Args:
3617
+ point_set (PointSet): The point set to check intersection with.
3618
+
3619
+ Returns:
3620
+ bool: True if the sphere intersects the point set.
3621
+
3622
+ Example:
3623
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3624
+ >>> sphere.intersects(PointSet([Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0)])) # True
3625
+ """
3626
+ @typing.overload
3627
+ def intersects(self, line: Line) -> bool:
3628
+ """
3629
+ Check if the sphere intersects a line.
3630
+
3631
+ Args:
3632
+ line (Line): The line to check intersection with.
3633
+
3634
+ Returns:
3635
+ bool: True if the sphere intersects the line.
3636
+
3637
+ Example:
3638
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3639
+ >>> sphere.intersects(Line(Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0))) # True
3640
+ """
3641
+ @typing.overload
3642
+ def intersects(self, ray: Ray) -> bool:
3643
+ """
3644
+ Check if the sphere intersects a ray.
3645
+
3646
+ Args:
3647
+ ray (Ray): The ray to check intersection with.
3648
+
3649
+ Returns:
3650
+ bool: True if the sphere intersects the ray.
3651
+
3652
+ Example:
3653
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3654
+ >>> sphere.intersects(Ray(Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0))) # True
3655
+ """
3656
+ @typing.overload
3657
+ def intersects(self, segment: Segment) -> bool:
3658
+ """
3659
+ Check if the sphere intersects a segment.
3660
+
3661
+ Args:
3662
+ segment (Segment): The segment to check intersection with.
3663
+
3664
+ Returns:
3665
+ bool: True if the sphere intersects the segment.
3666
+
3667
+ Example:
3668
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3669
+ >>> sphere.intersects(Segment(Point(1.0, 0.0, 0.0), Point(0.0, 1.0, 0.0))) # True
3670
+ """
3671
+ @typing.overload
3672
+ def intersects(self, plane: Plane) -> bool:
3673
+ """
3674
+ Check if the sphere intersects a plane.
3675
+
3676
+ Args:
3677
+ plane (Plane): The plane to check intersection with.
3678
+
3679
+ Returns:
3680
+ bool: True if the sphere intersects the plane.
3681
+
3682
+ Example:
3683
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3684
+ >>> sphere.intersects(Plane(Point(1.0, 0.0, 0.0), Vector3d(0.0, 0.0, 1.0))) # True
3685
+ """
3686
+ def is_defined(self) -> bool:
3687
+ """
3688
+ Check if the sphere is defined.
3689
+
3690
+ Returns:
3691
+ bool: True if the sphere is defined, False otherwise.
3692
+
3693
+ Example:
3694
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3695
+ >>> sphere.is_defined() # True
3696
+ """
3697
+ def is_unitary(self) -> bool:
3698
+ """
3699
+ Check if the sphere is a unit sphere (radius = 1).
3700
+
3701
+ Returns:
3702
+ bool: True if the sphere has unit radius, False otherwise.
3703
+
3704
+ Example:
3705
+ >>> sphere = Sphere(Point(0.0, 0.0, 0.0), 1.0)
3706
+ >>> sphere.is_unitary() # True
3707
+ """
3708
+ def set_point_3_array(arg0: list[Point]) -> None:
3709
+ ...