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,138 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+
7
+ from ostk.mathematics.geometry import Angle
8
+ from ostk.mathematics.geometry.d3.transformation.rotation import Quaternion
9
+ from ostk.mathematics.geometry.d3.transformation.rotation import RotationVector
10
+ from ostk.mathematics.geometry.d3.transformation.rotation import RotationMatrix
11
+ from ostk.mathematics.geometry.d3.transformation.rotation import EulerAngle
12
+
13
+
14
+ @pytest.fixture
15
+ def euler_angle() -> EulerAngle:
16
+ return EulerAngle.unit()
17
+
18
+
19
+ class TestEulerAngle:
20
+ def test_constructor_success(self):
21
+ EulerAngle(
22
+ phi=Angle.zero(),
23
+ theta=Angle.zero(),
24
+ psi=Angle.zero(),
25
+ axis_sequence=EulerAngle.AxisSequence.ZYX,
26
+ )
27
+
28
+ EulerAngle(
29
+ vector=(0.0, 0.0, 0.0),
30
+ angle_unit=Angle.Unit.Degree,
31
+ axis_sequence=EulerAngle.AxisSequence.ZYX,
32
+ )
33
+
34
+ def test_operators_success(self, euler_angle: EulerAngle):
35
+ assert (euler_angle == euler_angle) is True
36
+ assert (euler_angle != euler_angle) is False
37
+
38
+ def test_str_success(self, euler_angle: EulerAngle):
39
+ assert str(euler_angle) is not None
40
+
41
+ def test_repr_success(self, euler_angle: EulerAngle):
42
+ assert repr(euler_angle) is not None
43
+
44
+ def test_is_defined_success(self, euler_angle: EulerAngle):
45
+ assert euler_angle.is_defined()
46
+
47
+ def test_is_unitary_success(self, euler_angle: EulerAngle):
48
+ assert euler_angle.is_unitary()
49
+
50
+ def test_is_near_success(self, euler_angle: EulerAngle):
51
+ assert euler_angle.is_near(
52
+ euler_angle=euler_angle,
53
+ angular_tolerance=Angle.zero(),
54
+ )
55
+
56
+ def test_properties_success(self, euler_angle: EulerAngle):
57
+ assert euler_angle.phi == Angle.degrees(0.0)
58
+ assert euler_angle.theta == Angle.degrees(0.0)
59
+ assert euler_angle.psi == Angle.degrees(0.0)
60
+ assert euler_angle.axis_sequence == EulerAngle.AxisSequence.ZYX
61
+
62
+ def test_to_vector_success(self, euler_angle: EulerAngle):
63
+ assert np.array_equal(
64
+ euler_angle.to_vector(angle_unit=Angle.Unit.Degree), np.array((0.0, 0.0, 0.0))
65
+ )
66
+
67
+ def test_to_string_success(self, euler_angle: EulerAngle):
68
+ assert euler_angle.to_string() == "[0, 0, 0] (ZYX)"
69
+ assert euler_angle.to_string(angle_unit=Angle.Unit.Degree) == "[0, 0, 0] (ZYX)"
70
+
71
+ def test_undefined_success(self):
72
+ assert not EulerAngle.undefined().is_defined()
73
+
74
+ def test_unit_success(self, euler_angle: EulerAngle):
75
+ assert EulerAngle.unit() == euler_angle
76
+
77
+ def test_xyz_success(self):
78
+ assert EulerAngle.xyz(
79
+ phi=Angle.zero(),
80
+ theta=Angle.zero(),
81
+ psi=Angle.zero(),
82
+ ) == EulerAngle(
83
+ phi=Angle.zero(),
84
+ theta=Angle.zero(),
85
+ psi=Angle.zero(),
86
+ axis_sequence=EulerAngle.AxisSequence.XYZ,
87
+ )
88
+
89
+ def test_zxy_success(self):
90
+ assert EulerAngle.zxy(
91
+ phi=Angle.zero(),
92
+ theta=Angle.zero(),
93
+ psi=Angle.zero(),
94
+ ) == EulerAngle(
95
+ phi=Angle.zero(),
96
+ theta=Angle.zero(),
97
+ psi=Angle.zero(),
98
+ axis_sequence=EulerAngle.AxisSequence.ZXY,
99
+ )
100
+
101
+ def test_zyx_success(self):
102
+ assert EulerAngle.zyx(
103
+ phi=Angle.zero(),
104
+ theta=Angle.zero(),
105
+ psi=Angle.zero(),
106
+ ) == EulerAngle(
107
+ phi=Angle.zero(),
108
+ theta=Angle.zero(),
109
+ psi=Angle.zero(),
110
+ axis_sequence=EulerAngle.AxisSequence.ZYX,
111
+ )
112
+
113
+ def test_quaternion_success(self):
114
+ assert (
115
+ EulerAngle.quaternion(
116
+ quaternion=Quaternion.unit(),
117
+ axis_sequence=EulerAngle.AxisSequence.ZYX,
118
+ )
119
+ == EulerAngle.unit()
120
+ )
121
+
122
+ def test_rotation_vector_success(self):
123
+ assert (
124
+ EulerAngle.rotation_vector(
125
+ rotation_vector=RotationVector.unit(),
126
+ axis_sequence=EulerAngle.AxisSequence.ZYX,
127
+ )
128
+ == EulerAngle.unit()
129
+ )
130
+
131
+ def test_rotation_matrix_success(self):
132
+ assert (
133
+ EulerAngle.rotation_matrix(
134
+ rotation_matrix=RotationMatrix.unit(),
135
+ axis_sequence=EulerAngle.AxisSequence.ZYX,
136
+ )
137
+ == EulerAngle.unit()
138
+ )
@@ -0,0 +1,189 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+
7
+ from ostk.mathematics.geometry import Angle
8
+ from ostk.mathematics.geometry.d3.transformation.rotation import Quaternion
9
+ from ostk.mathematics.geometry.d3.transformation.rotation import RotationVector
10
+ from ostk.mathematics.geometry.d3.transformation.rotation import RotationMatrix
11
+ from ostk.mathematics.geometry.d3.transformation.rotation import EulerAngle
12
+
13
+
14
+ @pytest.fixture
15
+ def quaternion() -> Quaternion:
16
+ return Quaternion.xyzs(0.0, 0.0, 0.0, 1.0)
17
+
18
+
19
+ class TestQuaternion:
20
+ def test_constructor_success(self, quaternion: Quaternion):
21
+ assert Quaternion(0.0, 0.0, 0.0, 1.0, Quaternion.Format.XYZS) == quaternion
22
+ assert (
23
+ Quaternion(np.array((0.0, 0.0, 0.0, 1.0)), Quaternion.Format.XYZS)
24
+ == quaternion
25
+ )
26
+ assert Quaternion(np.array((0.0, 0.0, 0.0)), 1.0) == quaternion
27
+ assert Quaternion(quaternion) == quaternion
28
+
29
+ def test_operators_success(self, quaternion: Quaternion):
30
+ assert (quaternion == quaternion) is True
31
+ assert (quaternion != quaternion) is False
32
+
33
+ assert (quaternion + quaternion) == Quaternion.xyzs(0.0, 0.0, 0.0, 2.0)
34
+
35
+ quaternion_2 = Quaternion(quaternion)
36
+ quaternion_2 += quaternion
37
+ assert quaternion_2 == Quaternion.xyzs(0.0, 0.0, 0.0, 2.0)
38
+
39
+ assert (quaternion * 1.0) == quaternion
40
+ assert (1.0 * quaternion) == quaternion
41
+
42
+ assert (quaternion**1.0) == quaternion
43
+
44
+ def test_is_defined_success(self, quaternion: Quaternion):
45
+ assert quaternion.is_defined() is True
46
+
47
+ def test_is_unitary_success(self, quaternion: Quaternion):
48
+ assert quaternion.is_unitary() is True
49
+ assert quaternion.is_unitary(0.0001) is True
50
+
51
+ def test_is_near_success(self, quaternion: Quaternion):
52
+ assert quaternion.is_near(quaternion, Angle.zero()) is True
53
+
54
+ def test_getter_success(self, quaternion: Quaternion):
55
+ assert quaternion.x() == 0.0
56
+ assert quaternion.y() == 0.0
57
+ assert quaternion.z() == 0.0
58
+ assert quaternion.s() == 1.0
59
+
60
+ def test_get_vector_part_success(self, quaternion: Quaternion):
61
+ assert (
62
+ np.array_equal(quaternion.get_vector_part(), np.array((0.0, 0.0, 0.0)))
63
+ is True
64
+ )
65
+
66
+ def test_get_scalar_part_success(self, quaternion: Quaternion):
67
+ assert quaternion.get_scalar_part() == 1.0
68
+
69
+ def test_to_normalized_success(self, quaternion: Quaternion):
70
+ assert quaternion.to_normalized() == quaternion
71
+
72
+ def test_to_conjugate_success(self, quaternion: Quaternion):
73
+ assert quaternion.to_conjugate() == quaternion
74
+
75
+ def test_to_inverse_success(self, quaternion: Quaternion):
76
+ assert quaternion.to_inverse() == quaternion
77
+
78
+ def test_exp_success(self, quaternion: Quaternion):
79
+ assert quaternion.exp() == quaternion
80
+
81
+ def test_log_success(self, quaternion: Quaternion):
82
+ assert quaternion.log() == Quaternion.xyzs(0.0, 0.0, 0.0, 0.0)
83
+
84
+ def test_pow_success(self, quaternion: Quaternion):
85
+ assert quaternion.pow(1.0) == quaternion
86
+
87
+ def test_norm_success(self, quaternion: Quaternion):
88
+ assert quaternion.norm() == 1.0
89
+
90
+ def test_cross_multiply_success(self, quaternion: Quaternion):
91
+ assert quaternion.cross_multiply(quaternion) == quaternion
92
+
93
+ def test_dot_multiply_success(self, quaternion: Quaternion):
94
+ assert quaternion.dot_multiply(quaternion) == quaternion
95
+
96
+ def test_dot_product_success(self, quaternion: Quaternion):
97
+ assert quaternion.dot_product(quaternion) == 1.0
98
+
99
+ def test_rotate_vector_success(self, quaternion: Quaternion):
100
+ assert np.array_equal(
101
+ quaternion.rotate_vector(np.array((0.0, 0.0, 1.0))),
102
+ np.array((0.0, 0.0, 1.0)),
103
+ )
104
+
105
+ def test_to_vector_success(self, quaternion: Quaternion):
106
+ assert (
107
+ np.array_equal(
108
+ quaternion.to_vector(Quaternion.Format.XYZS),
109
+ np.array((0.0, 0.0, 0.0, 1.0)),
110
+ )
111
+ is True
112
+ )
113
+
114
+ def test_to_string_success(self, quaternion: Quaternion):
115
+ assert quaternion.to_string() == "[0.0, 0.0, 0.0, 1.0]"
116
+
117
+ def test_to_string_success_with_format(self, quaternion: Quaternion):
118
+ assert quaternion.to_string(Quaternion.Format.XYZS) == "[0.0, 0.0, 0.0, 1.0]"
119
+
120
+ def test_normalize_success(self, quaternion: Quaternion):
121
+ quaternion_2 = Quaternion(quaternion)
122
+ quaternion_2.normalize()
123
+ assert quaternion_2 == quaternion
124
+
125
+ def test_conjugate_success(self, quaternion: Quaternion):
126
+ quaternion_2 = Quaternion(quaternion)
127
+ quaternion_2.conjugate()
128
+ assert quaternion_2 == quaternion
129
+
130
+ def test_inverse_success(self, quaternion: Quaternion):
131
+ quaternion_2 = Quaternion(quaternion)
132
+ quaternion_2.inverse()
133
+ assert quaternion_2 == quaternion
134
+
135
+ def test_to_rectify_success(self, quaternion: Quaternion):
136
+ assert quaternion.to_rectify() == quaternion
137
+
138
+ def test_rectify_success(self, quaternion: Quaternion):
139
+ quaternion_2 = Quaternion(quaternion)
140
+ quaternion_2.rectify()
141
+ assert quaternion_2 == quaternion
142
+
143
+ def test_angular_difference_with_success(self, quaternion: Quaternion):
144
+ assert quaternion.angular_difference_with(quaternion) == Angle.zero()
145
+
146
+ def test_undefined_success(self):
147
+ assert Quaternion.undefined().is_defined() is False
148
+
149
+ def test_unit_success(self, quaternion: Quaternion):
150
+ assert Quaternion.unit() == quaternion
151
+
152
+ def test_xyzs_success(self, quaternion: Quaternion):
153
+ assert Quaternion.xyzs(0.0, 0.0, 0.0, 1.0) == quaternion
154
+
155
+ def test_rotation_vector_success(self, quaternion: Quaternion):
156
+ assert (
157
+ Quaternion.rotation_vector(
158
+ RotationVector(np.array((0.0, 0.0, 1.0)), Angle.zero())
159
+ )
160
+ == quaternion
161
+ )
162
+
163
+ def test_rotation_matrix_success(self, quaternion: Quaternion):
164
+ assert Quaternion.rotation_matrix(RotationMatrix.rz(Angle.zero())) == quaternion
165
+
166
+ def test_euler_angle_success(self, quaternion: Quaternion):
167
+ assert Quaternion.euler_angle(EulerAngle.unit()) == quaternion
168
+
169
+ def test_parse_success(self, quaternion: Quaternion):
170
+ assert (
171
+ Quaternion.parse("[0.0, 0.0, 0.0, 1.0]", Quaternion.Format.XYZS) == quaternion
172
+ )
173
+
174
+ def test_shortest_rotation_success(self, quaternion: Quaternion):
175
+ assert (
176
+ Quaternion.shortest_rotation(
177
+ np.array((1.0, 0.0, 0.0)), np.array((1.0, 0.0, 0.0))
178
+ )
179
+ == quaternion
180
+ )
181
+
182
+ def test_lerp_success(self, quaternion: Quaternion):
183
+ assert Quaternion.lerp(quaternion, quaternion, 0.0) == quaternion
184
+
185
+ def test_nlerp_success(self, quaternion: Quaternion):
186
+ assert Quaternion.nlerp(quaternion, quaternion, 0.0) == quaternion
187
+
188
+ def test_slerp_success(self, quaternion: Quaternion):
189
+ assert Quaternion.slerp(quaternion, quaternion, 0.0) == quaternion
@@ -0,0 +1,40 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+ import numpy as np
5
+
6
+ from ostk.mathematics.geometry.d3.transformation.rotation import Quaternion
7
+ from ostk.mathematics.geometry.d3.transformation.rotation import RotationMatrix
8
+ from ostk.mathematics.geometry.d3.transformation.rotation import EulerAngle
9
+
10
+
11
+ @pytest.fixture
12
+ def rotation_matrix() -> RotationMatrix:
13
+ return RotationMatrix.unit()
14
+
15
+
16
+ class TestRotationMatrix:
17
+ def test_is_defined_success(self, rotation_matrix: RotationMatrix):
18
+ assert rotation_matrix.is_defined() is True
19
+
20
+ def test_quaternion_success(self, rotation_matrix: RotationMatrix):
21
+ assert RotationMatrix.quaternion(Quaternion.unit()) == rotation_matrix
22
+
23
+ def test_euler_angle_success(self, rotation_matrix: RotationMatrix):
24
+ assert RotationMatrix.euler_angle(EulerAngle.unit()) == rotation_matrix
25
+
26
+ def test_getters(self, rotation_matrix: RotationMatrix):
27
+ assert rotation_matrix.get_column_at(0) is not None
28
+ assert rotation_matrix.get_row_at(1) is not None
29
+ assert rotation_matrix.get_matrix() is not None
30
+
31
+ def test_vector_basis_identity(self, rotation_matrix: RotationMatrix):
32
+ first_vector = np.array([1.0, 0.0, 0.0])
33
+ second_vector = np.array([0.0, 1.0, 0.0])
34
+
35
+ rotation_matrix = RotationMatrix.vector_basis(
36
+ source_vectors=(first_vector, second_vector),
37
+ destination_vectors=(first_vector, second_vector),
38
+ )
39
+
40
+ assert rotation_matrix is not None
@@ -0,0 +1,47 @@
1
+ # Apache License 2.0
2
+
3
+ import pytest
4
+
5
+ import numpy as np
6
+
7
+ from ostk.mathematics.geometry import Angle
8
+ from ostk.mathematics.geometry.d3.transformation.rotation import Quaternion
9
+ from ostk.mathematics.geometry.d3.transformation.rotation import RotationVector
10
+ from ostk.mathematics.geometry.d3.transformation.rotation import EulerAngle
11
+
12
+
13
+ @pytest.fixture
14
+ def rotation_vector() -> RotationVector:
15
+ return RotationVector.unit()
16
+
17
+
18
+ class TestRotationVector:
19
+ def test_constructor_success(self):
20
+ RotationVector(
21
+ axis=(0.0, 0.0, 1.0),
22
+ angle=Angle.zero(),
23
+ )
24
+
25
+ RotationVector(
26
+ vector=(0.0, 0.0, 1.0),
27
+ angle_unit=Angle.Unit.Degree,
28
+ )
29
+
30
+ def test_operators_success(self, rotation_vector: RotationVector):
31
+ assert (rotation_vector == rotation_vector) is True
32
+ assert (rotation_vector != rotation_vector) is False
33
+
34
+ def test_get_angle_success(self, rotation_vector: RotationVector):
35
+ assert rotation_vector.get_angle() == Angle.zero()
36
+
37
+ def test_is_defined_success(self, rotation_vector: RotationVector):
38
+ assert rotation_vector.is_defined() is True
39
+
40
+ def test_is_defined_success(self, rotation_vector: RotationVector):
41
+ rotation_vector.rectify()
42
+
43
+ def test_quaternion_success(self, rotation_vector: RotationVector):
44
+ assert RotationVector.quaternion(Quaternion.unit()) == rotation_vector
45
+
46
+ def test_euler_angle_success(self, rotation_vector: RotationVector):
47
+ assert RotationVector.euler_angle(EulerAngle.unit()) == rotation_vector