math3d-py 1.0.15__cp313-cp313-macosx_26_0_arm64.whl → 1.3.6__cp313-cp313-macosx_26_0_arm64.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Potentially problematic release.
This version of math3d-py might be problematic. Click here for more details.
- math3d/__init__.pyi +20 -0
- math3d/math3d.cpython-313-darwin.so +0 -0
- math3d/math3d.pyi +312 -0
- math3d/py.typed +0 -0
- math3d/types.hpp +50 -0
- math3d/vector.hpp +54 -36
- {math3d_py-1.0.15.dist-info → math3d_py-1.3.6.dist-info}/METADATA +2 -2
- math3d_py-1.3.6.dist-info/RECORD +15 -0
- math3d_py-1.0.15.dist-info/RECORD +0 -12
- {math3d_py-1.0.15.dist-info → math3d_py-1.3.6.dist-info}/WHEEL +0 -0
- {math3d_py-1.0.15.dist-info → math3d_py-1.3.6.dist-info}/licenses/LICENSE.txt +0 -0
math3d/__init__.pyi
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
from math3d.math3d import AABB
|
|
3
|
+
from math3d.math3d import Extent
|
|
4
|
+
from math3d.math3d import Identity2
|
|
5
|
+
from math3d.math3d import Identity3
|
|
6
|
+
from math3d.math3d import Identity4
|
|
7
|
+
from math3d.math3d import LinearSystem2
|
|
8
|
+
from math3d.math3d import LinearSystem3
|
|
9
|
+
from math3d.math3d import LinearSystem4
|
|
10
|
+
from math3d.math3d import Matrix2
|
|
11
|
+
from math3d.math3d import Matrix3
|
|
12
|
+
from math3d.math3d import Matrix4
|
|
13
|
+
from math3d.math3d import Vector2
|
|
14
|
+
from math3d.math3d import Vector3
|
|
15
|
+
from math3d.math3d import Vector4
|
|
16
|
+
from math3d.math3d import order
|
|
17
|
+
from . import math3d
|
|
18
|
+
__all__: list[str] = ['AABB', 'Extent', 'Identity2', 'Identity3', 'Identity4', 'LinearSystem2', 'LinearSystem3', 'LinearSystem4', 'Matrix2', 'Matrix3', 'Matrix4', 'Vector2', 'Vector3', 'Vector4', 'col_major', 'math3d', 'order', 'row_major']
|
|
19
|
+
col_major: order # value = <order.col_major: 0>
|
|
20
|
+
row_major: order # value = <order.row_major: 1>
|
|
Binary file
|
math3d/math3d.pyi
ADDED
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
from __future__ import annotations
|
|
2
|
+
import pybind11_stubgen.typing_ext
|
|
3
|
+
import typing
|
|
4
|
+
__all__: list[str] = ['AABB', 'Extent', 'Identity2', 'Identity3', 'Identity4', 'LinearSystem2', 'LinearSystem3', 'LinearSystem4', 'Matrix2', 'Matrix3', 'Matrix4', 'Vector2', 'Vector3', 'Vector4', 'col_major', 'order', 'row_major']
|
|
5
|
+
class AABB:
|
|
6
|
+
@typing.overload
|
|
7
|
+
def __init__(self) -> None:
|
|
8
|
+
...
|
|
9
|
+
@typing.overload
|
|
10
|
+
def __init__(self, arg0: Extent, arg1: Extent, arg2: Extent) -> None:
|
|
11
|
+
...
|
|
12
|
+
def __repr__(self) -> str:
|
|
13
|
+
...
|
|
14
|
+
def __str__(self) -> str:
|
|
15
|
+
...
|
|
16
|
+
def corners(self) -> typing.Annotated[list[Vector3], pybind11_stubgen.typing_ext.FixedSize(8)]:
|
|
17
|
+
...
|
|
18
|
+
def edges(self) -> typing.Annotated[list[typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(4)]], pybind11_stubgen.typing_ext.FixedSize(6)]:
|
|
19
|
+
...
|
|
20
|
+
def max(self) -> Vector3:
|
|
21
|
+
...
|
|
22
|
+
def merge(self, arg0: AABB) -> None:
|
|
23
|
+
...
|
|
24
|
+
def min(self) -> Vector3:
|
|
25
|
+
...
|
|
26
|
+
class Extent:
|
|
27
|
+
max: float
|
|
28
|
+
min: float
|
|
29
|
+
@typing.overload
|
|
30
|
+
def __init__(self) -> None:
|
|
31
|
+
...
|
|
32
|
+
@typing.overload
|
|
33
|
+
def __init__(self, arg0: float, arg1: float) -> None:
|
|
34
|
+
...
|
|
35
|
+
def __repr__(self) -> str:
|
|
36
|
+
...
|
|
37
|
+
def __str__(self) -> str:
|
|
38
|
+
...
|
|
39
|
+
def center(self) -> float:
|
|
40
|
+
...
|
|
41
|
+
def length(self) -> float:
|
|
42
|
+
...
|
|
43
|
+
def update(self, arg0: float) -> None:
|
|
44
|
+
...
|
|
45
|
+
class Identity2(Matrix2):
|
|
46
|
+
def __init__(self) -> None:
|
|
47
|
+
...
|
|
48
|
+
class Identity3(Matrix3):
|
|
49
|
+
def __init__(self) -> None:
|
|
50
|
+
...
|
|
51
|
+
class Identity4(Matrix4):
|
|
52
|
+
def __init__(self) -> None:
|
|
53
|
+
...
|
|
54
|
+
class LinearSystem2:
|
|
55
|
+
@staticmethod
|
|
56
|
+
def solve(arg0: Matrix2, arg1: Vector2) -> Vector2:
|
|
57
|
+
...
|
|
58
|
+
class LinearSystem3:
|
|
59
|
+
@staticmethod
|
|
60
|
+
def solve(arg0: Matrix3, arg1: Vector3) -> Vector3:
|
|
61
|
+
...
|
|
62
|
+
class LinearSystem4:
|
|
63
|
+
@staticmethod
|
|
64
|
+
def solve(arg0: Matrix4, arg1: Vector4) -> Vector4:
|
|
65
|
+
...
|
|
66
|
+
class Matrix2:
|
|
67
|
+
@typing.overload
|
|
68
|
+
def __getitem__(self, arg0: int) -> Vector2:
|
|
69
|
+
...
|
|
70
|
+
@typing.overload
|
|
71
|
+
def __getitem__(self, arg0: tuple[int, int]) -> float:
|
|
72
|
+
...
|
|
73
|
+
@typing.overload
|
|
74
|
+
def __init__(self) -> None:
|
|
75
|
+
...
|
|
76
|
+
@typing.overload
|
|
77
|
+
def __init__(self, arg0: typing.Iterable, arg1: order) -> None:
|
|
78
|
+
...
|
|
79
|
+
@typing.overload
|
|
80
|
+
def __mul__(self, arg0: Matrix2) -> Matrix2:
|
|
81
|
+
...
|
|
82
|
+
@typing.overload
|
|
83
|
+
def __mul__(self, arg0: Vector2) -> Vector2:
|
|
84
|
+
...
|
|
85
|
+
def __repr__(self) -> str:
|
|
86
|
+
...
|
|
87
|
+
def __str__(self) -> str:
|
|
88
|
+
...
|
|
89
|
+
def determinant(self) -> float:
|
|
90
|
+
...
|
|
91
|
+
def inverse(self) -> Matrix2:
|
|
92
|
+
...
|
|
93
|
+
def row(self, arg0: int) -> Vector2:
|
|
94
|
+
...
|
|
95
|
+
def transpose(self) -> Matrix2:
|
|
96
|
+
...
|
|
97
|
+
def upper_triangular(self) -> Matrix2:
|
|
98
|
+
...
|
|
99
|
+
class Matrix3:
|
|
100
|
+
@typing.overload
|
|
101
|
+
def __getitem__(self, arg0: int) -> Vector3:
|
|
102
|
+
...
|
|
103
|
+
@typing.overload
|
|
104
|
+
def __getitem__(self, arg0: tuple[int, int]) -> float:
|
|
105
|
+
...
|
|
106
|
+
@typing.overload
|
|
107
|
+
def __init__(self) -> None:
|
|
108
|
+
...
|
|
109
|
+
@typing.overload
|
|
110
|
+
def __init__(self, arg0: typing.Iterable, arg1: order) -> None:
|
|
111
|
+
...
|
|
112
|
+
@typing.overload
|
|
113
|
+
def __mul__(self, arg0: Matrix3) -> Matrix3:
|
|
114
|
+
...
|
|
115
|
+
@typing.overload
|
|
116
|
+
def __mul__(self, arg0: Vector3) -> Vector3:
|
|
117
|
+
...
|
|
118
|
+
def __repr__(self) -> str:
|
|
119
|
+
...
|
|
120
|
+
def __str__(self) -> str:
|
|
121
|
+
...
|
|
122
|
+
def determinant(self) -> float:
|
|
123
|
+
...
|
|
124
|
+
def inverse(self) -> Matrix3:
|
|
125
|
+
...
|
|
126
|
+
def row(self, arg0: int) -> Vector3:
|
|
127
|
+
...
|
|
128
|
+
def transpose(self) -> Matrix3:
|
|
129
|
+
...
|
|
130
|
+
def upper_triangular(self) -> Matrix3:
|
|
131
|
+
...
|
|
132
|
+
class Matrix4:
|
|
133
|
+
@typing.overload
|
|
134
|
+
def __getitem__(self, arg0: int) -> Vector4:
|
|
135
|
+
...
|
|
136
|
+
@typing.overload
|
|
137
|
+
def __getitem__(self, arg0: tuple[int, int]) -> float:
|
|
138
|
+
...
|
|
139
|
+
@typing.overload
|
|
140
|
+
def __init__(self) -> None:
|
|
141
|
+
...
|
|
142
|
+
@typing.overload
|
|
143
|
+
def __init__(self, arg0: typing.Iterable, arg1: order) -> None:
|
|
144
|
+
...
|
|
145
|
+
@typing.overload
|
|
146
|
+
def __mul__(self, arg0: Matrix4) -> Matrix4:
|
|
147
|
+
...
|
|
148
|
+
@typing.overload
|
|
149
|
+
def __mul__(self, arg0: Vector4) -> Vector4:
|
|
150
|
+
...
|
|
151
|
+
def __repr__(self) -> str:
|
|
152
|
+
...
|
|
153
|
+
def __str__(self) -> str:
|
|
154
|
+
...
|
|
155
|
+
def determinant(self) -> float:
|
|
156
|
+
...
|
|
157
|
+
def inverse(self) -> Matrix4:
|
|
158
|
+
...
|
|
159
|
+
def row(self, arg0: int) -> Vector4:
|
|
160
|
+
...
|
|
161
|
+
def transpose(self) -> Matrix4:
|
|
162
|
+
...
|
|
163
|
+
def upper_triangular(self) -> Matrix4:
|
|
164
|
+
...
|
|
165
|
+
class Vector2:
|
|
166
|
+
x: float
|
|
167
|
+
y: float
|
|
168
|
+
def __add__(self, arg0: Vector2) -> Vector2:
|
|
169
|
+
...
|
|
170
|
+
@typing.overload
|
|
171
|
+
def __init__(self) -> None:
|
|
172
|
+
...
|
|
173
|
+
@typing.overload
|
|
174
|
+
def __init__(self, arg0: typing.Iterable) -> None:
|
|
175
|
+
...
|
|
176
|
+
def __mul__(self, arg0: float) -> Vector2:
|
|
177
|
+
...
|
|
178
|
+
def __repr__(self) -> str:
|
|
179
|
+
...
|
|
180
|
+
def __str__(self) -> str:
|
|
181
|
+
...
|
|
182
|
+
def __sub__(self, arg0: Vector2) -> Vector2:
|
|
183
|
+
...
|
|
184
|
+
def __truediv__(self, arg0: float) -> Vector2:
|
|
185
|
+
...
|
|
186
|
+
def dot(self, arg0: Vector2) -> float:
|
|
187
|
+
...
|
|
188
|
+
def length(self) -> float:
|
|
189
|
+
...
|
|
190
|
+
def length_sqr(self) -> float:
|
|
191
|
+
...
|
|
192
|
+
def normalize(self) -> Vector2:
|
|
193
|
+
...
|
|
194
|
+
def projection(self, arg0: Vector2) -> tuple[Vector2, Vector2]:
|
|
195
|
+
...
|
|
196
|
+
class Vector3:
|
|
197
|
+
x: float
|
|
198
|
+
y: float
|
|
199
|
+
z: float
|
|
200
|
+
def __add__(self, arg0: Vector3) -> Vector3:
|
|
201
|
+
...
|
|
202
|
+
@typing.overload
|
|
203
|
+
def __init__(self) -> None:
|
|
204
|
+
...
|
|
205
|
+
@typing.overload
|
|
206
|
+
def __init__(self, arg0: typing.Iterable) -> None:
|
|
207
|
+
...
|
|
208
|
+
@typing.overload
|
|
209
|
+
def __init__(self, arg0: float, arg1: float, arg2: float) -> None:
|
|
210
|
+
...
|
|
211
|
+
@typing.overload
|
|
212
|
+
def __mul__(self, arg0: float) -> Vector3:
|
|
213
|
+
...
|
|
214
|
+
@typing.overload
|
|
215
|
+
def __mul__(self, arg0: Vector3) -> Vector3:
|
|
216
|
+
...
|
|
217
|
+
def __repr__(self) -> str:
|
|
218
|
+
...
|
|
219
|
+
def __str__(self) -> str:
|
|
220
|
+
...
|
|
221
|
+
def __sub__(self, arg0: Vector3) -> Vector3:
|
|
222
|
+
...
|
|
223
|
+
def __truediv__(self, arg0: float) -> Vector3:
|
|
224
|
+
...
|
|
225
|
+
def dot(self, arg0: Vector3) -> float:
|
|
226
|
+
...
|
|
227
|
+
def length(self) -> float:
|
|
228
|
+
...
|
|
229
|
+
def length_sqr(self) -> float:
|
|
230
|
+
...
|
|
231
|
+
def normalize(self) -> Vector3:
|
|
232
|
+
...
|
|
233
|
+
def projection(self, arg0: Vector3) -> tuple[Vector3, Vector3]:
|
|
234
|
+
...
|
|
235
|
+
class Vector4:
|
|
236
|
+
w: float
|
|
237
|
+
x: float
|
|
238
|
+
y: float
|
|
239
|
+
z: float
|
|
240
|
+
def __add__(self, arg0: Vector4) -> Vector4:
|
|
241
|
+
...
|
|
242
|
+
@typing.overload
|
|
243
|
+
def __init__(self) -> None:
|
|
244
|
+
...
|
|
245
|
+
@typing.overload
|
|
246
|
+
def __init__(self, arg0: typing.Iterable) -> None:
|
|
247
|
+
...
|
|
248
|
+
@typing.overload
|
|
249
|
+
def __init__(self, arg0: float, arg1: float, arg2: float, arg3: float) -> None:
|
|
250
|
+
...
|
|
251
|
+
@typing.overload
|
|
252
|
+
def __init__(self, arg0: Vector3) -> None:
|
|
253
|
+
...
|
|
254
|
+
def __mul__(self, arg0: float) -> Vector4:
|
|
255
|
+
...
|
|
256
|
+
def __repr__(self) -> str:
|
|
257
|
+
...
|
|
258
|
+
def __str__(self) -> str:
|
|
259
|
+
...
|
|
260
|
+
def __sub__(self, arg0: Vector4) -> Vector4:
|
|
261
|
+
...
|
|
262
|
+
def __truediv__(self, arg0: float) -> Vector4:
|
|
263
|
+
...
|
|
264
|
+
def dot(self, arg0: Vector4) -> float:
|
|
265
|
+
...
|
|
266
|
+
def length(self) -> float:
|
|
267
|
+
...
|
|
268
|
+
def length_sqr(self) -> float:
|
|
269
|
+
...
|
|
270
|
+
def normalize(self) -> Vector4:
|
|
271
|
+
...
|
|
272
|
+
def projection(self, arg0: Vector4) -> tuple[Vector4, Vector4]:
|
|
273
|
+
...
|
|
274
|
+
class order:
|
|
275
|
+
"""
|
|
276
|
+
Members:
|
|
277
|
+
|
|
278
|
+
row_major
|
|
279
|
+
|
|
280
|
+
col_major
|
|
281
|
+
"""
|
|
282
|
+
__members__: typing.ClassVar[dict[str, order]] # value = {'row_major': <order.row_major: 1>, 'col_major': <order.col_major: 0>}
|
|
283
|
+
col_major: typing.ClassVar[order] # value = <order.col_major: 0>
|
|
284
|
+
row_major: typing.ClassVar[order] # value = <order.row_major: 1>
|
|
285
|
+
def __eq__(self, other: typing.Any) -> bool:
|
|
286
|
+
...
|
|
287
|
+
def __getstate__(self) -> int:
|
|
288
|
+
...
|
|
289
|
+
def __hash__(self) -> int:
|
|
290
|
+
...
|
|
291
|
+
def __index__(self) -> int:
|
|
292
|
+
...
|
|
293
|
+
def __init__(self, value: int) -> None:
|
|
294
|
+
...
|
|
295
|
+
def __int__(self) -> int:
|
|
296
|
+
...
|
|
297
|
+
def __ne__(self, other: typing.Any) -> bool:
|
|
298
|
+
...
|
|
299
|
+
def __repr__(self) -> str:
|
|
300
|
+
...
|
|
301
|
+
def __setstate__(self, state: int) -> None:
|
|
302
|
+
...
|
|
303
|
+
def __str__(self) -> str:
|
|
304
|
+
...
|
|
305
|
+
@property
|
|
306
|
+
def name(self) -> str:
|
|
307
|
+
...
|
|
308
|
+
@property
|
|
309
|
+
def value(self) -> int:
|
|
310
|
+
...
|
|
311
|
+
col_major: order # value = <order.col_major: 0>
|
|
312
|
+
row_major: order # value = <order.row_major: 1>
|
math3d/py.typed
ADDED
|
File without changes
|
math3d/types.hpp
CHANGED
|
@@ -11,18 +11,44 @@ template<typename T>
|
|
|
11
11
|
void bind_Extent(py::module_ const& module, std::string_view className) {
|
|
12
12
|
using Extent = m3d::Extent<T>;
|
|
13
13
|
py::class_<Extent>(module, className.data())
|
|
14
|
+
.def(py::init([] {
|
|
15
|
+
Extent extent;
|
|
16
|
+
extent.min = std::numeric_limits<T>::max();
|
|
17
|
+
extent.max = -std::numeric_limits<T>::max();
|
|
18
|
+
return extent;
|
|
19
|
+
}))
|
|
14
20
|
.def(py::init([](T min, T max) {
|
|
15
21
|
Extent extent {};
|
|
16
22
|
extent.min = min;
|
|
17
23
|
extent.max = max;
|
|
18
24
|
return extent;
|
|
19
25
|
}))
|
|
26
|
+
.def_property("min",
|
|
27
|
+
[](Extent const& extent) {
|
|
28
|
+
return extent.min;
|
|
29
|
+
},
|
|
30
|
+
[](Extent& extent, T min) {
|
|
31
|
+
extent.min = min;
|
|
32
|
+
}
|
|
33
|
+
)
|
|
34
|
+
.def_property("max",
|
|
35
|
+
[](Extent const& extent) {
|
|
36
|
+
return extent.max;
|
|
37
|
+
},
|
|
38
|
+
[](Extent& extent, T max) {
|
|
39
|
+
extent.max = max;
|
|
40
|
+
}
|
|
41
|
+
)
|
|
20
42
|
.def("length", [](Extent const& extent) {
|
|
21
43
|
return extent.length();
|
|
22
44
|
})
|
|
23
45
|
.def("center", [](Extent const& extent) {
|
|
24
46
|
return extent.center();
|
|
25
47
|
})
|
|
48
|
+
.def("update", [](Extent& extent, T val) {
|
|
49
|
+
extent.min = std::min(extent.min, val);
|
|
50
|
+
extent.max = std::max(extent.max, val);
|
|
51
|
+
})
|
|
26
52
|
.def("__str__", [](Extent const& extent) {
|
|
27
53
|
return extent.asString();
|
|
28
54
|
})
|
|
@@ -39,6 +65,30 @@ void bind_Bounds(py::module_ const& module, std::string_view className) {
|
|
|
39
65
|
.def(py::init([](m3d::Extent<T> const& x, m3d::Extent<T> const& y, m3d::Extent<T> const& z) {
|
|
40
66
|
return Bounds {x, y, z};
|
|
41
67
|
}))
|
|
68
|
+
.def("min", [](Bounds const& self) {
|
|
69
|
+
return self.min();
|
|
70
|
+
})
|
|
71
|
+
.def("max", [](Bounds const& self) {
|
|
72
|
+
return self.max();
|
|
73
|
+
})
|
|
74
|
+
.def("corners", [](Bounds const& self) {
|
|
75
|
+
return self.corners();
|
|
76
|
+
})
|
|
77
|
+
.def("edges", [](Bounds const& self) {
|
|
78
|
+
return self.edges();
|
|
79
|
+
})
|
|
80
|
+
.def("merge", [](Bounds& self, Bounds const& another) {
|
|
81
|
+
self.merge(another);
|
|
82
|
+
})
|
|
83
|
+
.def("x_extent", [](Bounds const& self) {
|
|
84
|
+
return self.extent(Bounds::Direction::x);
|
|
85
|
+
})
|
|
86
|
+
.def("y_extent", [](Bounds const& self) {
|
|
87
|
+
return self.extent(Bounds::Direction::y);
|
|
88
|
+
})
|
|
89
|
+
.def("z_extent", [](Bounds const& self) {
|
|
90
|
+
return self.extent(Bounds::Direction::z);
|
|
91
|
+
})
|
|
42
92
|
.def("__str__", [](Bounds const& bounds) {
|
|
43
93
|
return bounds.asString();
|
|
44
94
|
})
|
math3d/vector.hpp
CHANGED
|
@@ -10,7 +10,7 @@ namespace py = pybind11;
|
|
|
10
10
|
template<typename T, uint32_t Size>
|
|
11
11
|
void bind_Vector(py::module_ const& module, char const* className) {
|
|
12
12
|
using vector = math3d::Vector<T, Size>;
|
|
13
|
-
auto
|
|
13
|
+
auto pyVecClass =
|
|
14
14
|
py::class_<vector>(module, className)
|
|
15
15
|
// Construction
|
|
16
16
|
.def(py::init())
|
|
@@ -18,38 +18,6 @@ void bind_Vector(py::module_ const& module, char const* className) {
|
|
|
18
18
|
auto const input = list.cast<std::vector<T>>();
|
|
19
19
|
return vector{input};
|
|
20
20
|
}))
|
|
21
|
-
.def(py::init([](math3d::Vector3<T> const& vec3) {
|
|
22
|
-
std::vector<T> input {vec3.x, vec3.y, vec3.z, 1.F};
|
|
23
|
-
return vector{input};
|
|
24
|
-
}))
|
|
25
|
-
// Member access
|
|
26
|
-
.def_property("x",
|
|
27
|
-
[](vector const& self) {
|
|
28
|
-
double const value = self.x;
|
|
29
|
-
return value;
|
|
30
|
-
},
|
|
31
|
-
[](vector& self, double const value) {
|
|
32
|
-
self.x = value;
|
|
33
|
-
}
|
|
34
|
-
)
|
|
35
|
-
.def_property("y",
|
|
36
|
-
[](vector const& self) {
|
|
37
|
-
T const value = self.y;
|
|
38
|
-
return value;
|
|
39
|
-
},
|
|
40
|
-
[](vector& self, double const value) {
|
|
41
|
-
self.y = value;
|
|
42
|
-
}
|
|
43
|
-
)
|
|
44
|
-
.def_property("z",
|
|
45
|
-
[](vector const& self) {
|
|
46
|
-
T const value = self.z;
|
|
47
|
-
return value;
|
|
48
|
-
},
|
|
49
|
-
[](vector& self, double const value) {
|
|
50
|
-
self.z = value;
|
|
51
|
-
}
|
|
52
|
-
)
|
|
53
21
|
// Formatted output
|
|
54
22
|
.def("__str__", [](vector const& v) {
|
|
55
23
|
return util::convertSpaceToNewLine(v.asString());
|
|
@@ -66,18 +34,68 @@ void bind_Vector(py::module_ const& module, char const* className) {
|
|
|
66
34
|
.def("normalize", [](vector& v) { v.normalize(); return v; })
|
|
67
35
|
.def("length", [](vector const& v) { return v.length(); })
|
|
68
36
|
.def("length_sqr", [](vector const& v) { return v.lengthSquared(); })
|
|
69
|
-
.def("projection", &vector
|
|
37
|
+
.def("projection", [](vector const& self, vector const& u) {
|
|
38
|
+
auto vectorProjection = self.getVectorProjection(u);
|
|
39
|
+
return std::pair{vectorProjection.parallel, vectorProjection.perpendicular};
|
|
40
|
+
});
|
|
70
41
|
if constexpr (Size == 3) {
|
|
71
|
-
|
|
42
|
+
pyVecClass
|
|
72
43
|
.def(py::init([](T x, T y, T z) {
|
|
73
44
|
return vector({x, y, z});
|
|
74
45
|
}))
|
|
75
46
|
.def(py::self * py::self);
|
|
76
47
|
}
|
|
77
48
|
if constexpr (Size == 4) {
|
|
78
|
-
|
|
49
|
+
pyVecClass
|
|
79
50
|
.def(py::init([](T x, T y, T z, T w) {
|
|
80
51
|
return vector({x, y, z, w});
|
|
52
|
+
}))
|
|
53
|
+
.def(py::init([](math3d::Vector3<T> const& vec3) {
|
|
54
|
+
std::vector<T> input {vec3.x, vec3.y, vec3.z, 1.F};
|
|
55
|
+
return vector{input};
|
|
81
56
|
}));
|
|
82
57
|
}
|
|
58
|
+
|
|
59
|
+
// Convenience member access (x, y, z, w)
|
|
60
|
+
// .x, .y, .z, .w are Vector<T, N>::Proxy and its conversion operator has to be invoked to get the raw value
|
|
61
|
+
// hence the static cast
|
|
62
|
+
if constexpr (Size >= 2 && Size <= 4) {
|
|
63
|
+
pyVecClass.def_property("x",
|
|
64
|
+
[](vector const& self) {
|
|
65
|
+
return static_cast<T>(self.x);
|
|
66
|
+
},
|
|
67
|
+
[](vector& self, T value) {
|
|
68
|
+
self.x = value;
|
|
69
|
+
}
|
|
70
|
+
)
|
|
71
|
+
.def_property("y",
|
|
72
|
+
[](vector const& self) {
|
|
73
|
+
return static_cast<T>(self.y);
|
|
74
|
+
},
|
|
75
|
+
[](vector& self, T value) {
|
|
76
|
+
self.y = value;
|
|
77
|
+
}
|
|
78
|
+
);
|
|
79
|
+
}
|
|
80
|
+
if constexpr (Size == 3 || Size == 4 ) {
|
|
81
|
+
pyVecClass.def_property("z",
|
|
82
|
+
[](vector const& self) {
|
|
83
|
+
return static_cast<T>(self.z);
|
|
84
|
+
},
|
|
85
|
+
[](vector& self, T value) {
|
|
86
|
+
self.z = value;
|
|
87
|
+
}
|
|
88
|
+
);
|
|
89
|
+
}
|
|
90
|
+
if constexpr (Size == 4) {
|
|
91
|
+
pyVecClass.def_property("w",
|
|
92
|
+
[](vector const& self) {
|
|
93
|
+
return static_cast<T>(self.w);
|
|
94
|
+
},
|
|
95
|
+
[](vector& self, T value) {
|
|
96
|
+
self.w = value;
|
|
97
|
+
}
|
|
98
|
+
);
|
|
99
|
+
}
|
|
100
|
+
|
|
83
101
|
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
math3d/__init__.py,sha256=U3FgsmZvyl9BitOWo7kiMfFemdDIT0nZTtZAel8GCXs,21
|
|
2
|
+
math3d/__init__.pyi,sha256=BqhiZ42zIc6WEblZOJOyQ3QIAxbAoWTZ496v4m0u-hY,923
|
|
3
|
+
math3d/linear_system.hpp,sha256=N0DaHua78qMjxq1hRrB_RFeG4-t6TO4MstGoNwLVCFs,379
|
|
4
|
+
math3d/math3d.cpp,sha256=RsEDIrIjGn06EucUdMHZZcNUru-UOc28Ufz9HobWu18,3942
|
|
5
|
+
math3d/math3d.cpython-313-darwin.so,sha256=JPMHyoCWa2Uw6fpN7Gb_up-8fY26Hj_ZSP1w0TYIkas,452544
|
|
6
|
+
math3d/math3d.pyi,sha256=SyClw-njG9Z3fR8I5VIKBNI9A_l3A521vmgbt0QzEA0,8416
|
|
7
|
+
math3d/matrix.hpp,sha256=eSaPQgQQuxGhtrtTVGn9UeI9EwquaF115qAUOaLcRG0,1921
|
|
8
|
+
math3d/py.typed,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
|
|
9
|
+
math3d/types.hpp,sha256=HBO7ofA716TPr4Kq_KcQ-EaD506b_637vvCcnm_4-y4,3129
|
|
10
|
+
math3d/util.h,sha256=toCfaPyeqdMrVyiic9_mSOaSjIj6WaBeXla0_7jOFFE,351
|
|
11
|
+
math3d/vector.hpp,sha256=G2o5HBorItNefu94GpVTaMtSwVsHH-AgV2B9dEHZsmk,3314
|
|
12
|
+
math3d_py-1.3.6.dist-info/METADATA,sha256=aqQlYsLBMZ_Jrt5hN71tUeGQQsRZhsoP202P1qj1BY4,180
|
|
13
|
+
math3d_py-1.3.6.dist-info/WHEEL,sha256=JBPQcDhGdVJVVdP1iHcQD7YbZNLPHXKI0EmTIQUqW5M,114
|
|
14
|
+
math3d_py-1.3.6.dist-info/licenses/LICENSE.txt,sha256=2AI_7H-vwBwrcWaaH8JmWMvJsT0rKRrENEAxZaxO1vc,18279
|
|
15
|
+
math3d_py-1.3.6.dist-info/RECORD,,
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
math3d/__init__.py,sha256=U3FgsmZvyl9BitOWo7kiMfFemdDIT0nZTtZAel8GCXs,21
|
|
2
|
-
math3d/linear_system.hpp,sha256=N0DaHua78qMjxq1hRrB_RFeG4-t6TO4MstGoNwLVCFs,379
|
|
3
|
-
math3d/math3d.cpp,sha256=RsEDIrIjGn06EucUdMHZZcNUru-UOc28Ufz9HobWu18,3942
|
|
4
|
-
math3d/math3d.cpython-313-darwin.so,sha256=8T3JJuvaUE5LT2kKtmjJLzH-8VRjklv6Na_5dBfhkWA,435936
|
|
5
|
-
math3d/matrix.hpp,sha256=eSaPQgQQuxGhtrtTVGn9UeI9EwquaF115qAUOaLcRG0,1921
|
|
6
|
-
math3d/types.hpp,sha256=cHG9oyXP2RhiNcYoDjm0rZWsVLYPMULMPGgvzTlMvcw,1714
|
|
7
|
-
math3d/util.h,sha256=toCfaPyeqdMrVyiic9_mSOaSjIj6WaBeXla0_7jOFFE,351
|
|
8
|
-
math3d/vector.hpp,sha256=LmuAudIoZpX6lGBN-PqIi50Z1o9Dca3UUxlZjLwYbIg,2611
|
|
9
|
-
math3d_py-1.0.15.dist-info/METADATA,sha256=O1_5tkPXm6tSs0dInddYKDQXirVt8yYCagw5q8fbY3g,175
|
|
10
|
-
math3d_py-1.0.15.dist-info/WHEEL,sha256=JBPQcDhGdVJVVdP1iHcQD7YbZNLPHXKI0EmTIQUqW5M,114
|
|
11
|
-
math3d_py-1.0.15.dist-info/licenses/LICENSE.txt,sha256=2AI_7H-vwBwrcWaaH8JmWMvJsT0rKRrENEAxZaxO1vc,18279
|
|
12
|
-
math3d_py-1.0.15.dist-info/RECORD,,
|
|
File without changes
|
|
File without changes
|