math3d-py 1.3.4__tar.gz → 1.4.1__tar.gz

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.

Files changed (87) hide show
  1. {math3d_py-1.3.4 → math3d_py-1.4.1}/PKG-INFO +1 -1
  2. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/SupportingTypes.h +56 -0
  3. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/math3d.pyi +24 -0
  4. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/types.hpp +24 -0
  5. {math3d_py-1.3.4/tmp → math3d_py-1.4.1/py}/math3d/vector.hpp +1 -0
  6. {math3d_py-1.3.4 → math3d_py-1.4.1}/pyproject.toml +1 -1
  7. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/Types.cpp +8 -0
  8. {math3d_py-1.3.4 → math3d_py-1.4.1}/.DS_Store +0 -0
  9. {math3d_py-1.3.4 → math3d_py-1.4.1}/.github/workflows/cmake-single-platform.yml +0 -0
  10. {math3d_py-1.3.4 → math3d_py-1.4.1}/.github/workflows/jekyll-gh-pages.yml +0 -0
  11. {math3d_py-1.3.4 → math3d_py-1.4.1}/.gitignore +0 -0
  12. {math3d_py-1.3.4 → math3d_py-1.4.1}/.idea/.gitignore +0 -0
  13. {math3d_py-1.3.4 → math3d_py-1.4.1}/.idea/3dmath.iml +0 -0
  14. {math3d_py-1.3.4 → math3d_py-1.4.1}/.idea/editor.xml +0 -0
  15. {math3d_py-1.3.4 → math3d_py-1.4.1}/.idea/misc.xml +0 -0
  16. {math3d_py-1.3.4 → math3d_py-1.4.1}/.idea/modules.xml +0 -0
  17. {math3d_py-1.3.4 → math3d_py-1.4.1}/.idea/vcs.xml +0 -0
  18. {math3d_py-1.3.4 → math3d_py-1.4.1}/CMakeLists.txt +0 -0
  19. {math3d_py-1.3.4 → math3d_py-1.4.1}/LICENSE.txt +0 -0
  20. {math3d_py-1.3.4 → math3d_py-1.4.1}/README.md +0 -0
  21. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/.DS_Store +0 -0
  22. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/Constants.h +0 -0
  23. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/IdentityMatrix.h +0 -0
  24. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/LinearSystem.h +0 -0
  25. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/Matrix.h +0 -0
  26. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/MatrixOperations.h +0 -0
  27. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/MatrixUtil.h +0 -0
  28. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/OrthographicProjectionMatrix.h +0 -0
  29. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/PolarCoordinates.h +0 -0
  30. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/ProjectionMatrix.h +0 -0
  31. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/Quaternion.h +0 -0
  32. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/RotationMatrix.h +0 -0
  33. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/ScalingMatrix.h +0 -0
  34. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/TranslationMatrix.h +0 -0
  35. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/TypeAliases.h +0 -0
  36. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/Utilities.h +0 -0
  37. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/Vector.h +0 -0
  38. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/primitives/ConvexPrimitive.h +0 -0
  39. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/primitives/Plane.h +0 -0
  40. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/primitives/Primitive.h +0 -0
  41. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/primitives/Ray.h +0 -0
  42. {math3d_py-1.3.4 → math3d_py-1.4.1}/include/3dmath/primitives/Sphere.h +0 -0
  43. {math3d_py-1.3.4 → math3d_py-1.4.1}/poetry.lock +0 -0
  44. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/CMakeLists.txt +0 -0
  45. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/__init__.py +0 -0
  46. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/__init__.pyi +0 -0
  47. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/linear_system.hpp +0 -0
  48. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/math3d.cpp +0 -0
  49. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/matrix.hpp +0 -0
  50. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/py.typed +0 -0
  51. {math3d_py-1.3.4 → math3d_py-1.4.1}/py/math3d/util.h +0 -0
  52. {math3d_py-1.3.4 → math3d_py-1.4.1}/pypublish +0 -0
  53. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/CMakeLists.txt +0 -0
  54. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/ConvexPrimitive.cpp +0 -0
  55. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/LinearSystem.cpp +0 -0
  56. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/Matrix.cpp +0 -0
  57. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/MatrixOperations.cpp +0 -0
  58. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/OrthographicProjectionMatrix.cpp +0 -0
  59. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/Plane.cpp +0 -0
  60. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/PolarCoordinates.cpp +0 -0
  61. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/Quaternion.cpp +0 -0
  62. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/Ray.cpp +0 -0
  63. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/RotationMatrix.cpp +0 -0
  64. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/ScalingMatrix.cpp +0 -0
  65. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/Sphere.cpp +0 -0
  66. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/TestSupport.h +0 -0
  67. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/TranslationMatrix.cpp +0 -0
  68. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/Vector.cpp +0 -0
  69. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/VectorConvenienceMembers.cpp +0 -0
  70. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/baseline/Ray.obj +0 -0
  71. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/baseline/Sphere.obj +0 -0
  72. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/baseline/Sphere.stl +0 -0
  73. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/baseline/Xy.stl +0 -0
  74. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/baseline/Xz.stl +0 -0
  75. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/baseline/Yz.stl +0 -0
  76. {math3d_py-1.3.4 → math3d_py-1.4.1}/tests/support/PrimitivesTestSupport.h +0 -0
  77. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/__init__.py +0 -0
  78. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/__init__.pyi +0 -0
  79. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/linear_system.hpp +0 -0
  80. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/math3d.cpp +0 -0
  81. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/math3d.cpython-313-darwin.so +0 -0
  82. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/math3d.pyi +0 -0
  83. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/matrix.hpp +0 -0
  84. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/py.typed +0 -0
  85. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/types.hpp +0 -0
  86. {math3d_py-1.3.4 → math3d_py-1.4.1}/tmp/math3d/util.h +0 -0
  87. {math3d_py-1.3.4/py → math3d_py-1.4.1/tmp}/math3d/vector.hpp +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.2
2
2
  Name: math3d_py
3
- Version: 1.3.4
3
+ Version: 1.4.1
4
4
  Summary: Python bindings for 3dmath
5
5
  Author-Email: Murali Dhanakoti <dhanakoti.murali@gmail.com>
6
6
  Requires-Python: <3.14,>=3.13
@@ -153,6 +153,62 @@ namespace math3d {
153
153
  Vector3<T> max() const {
154
154
  return {x.max, y.max, z.max};
155
155
  }
156
+
157
+ /// @brief Gets the corner vertices of this bounding box
158
+ ///
159
+ /// The corners are returned lower back to front with the bottom corners appearing before the top ones
160
+ [[nodiscard]]
161
+ std::array<Vector3<T>, 8> corners() const {
162
+ using Vec3 = Vector3<T>;
163
+
164
+ auto lower_left_back = min();
165
+ auto lower_right_back = lower_left_back + Vec3{x.length(), 0, 0};
166
+ auto upper_right_back= lower_right_back + Vec3{0, y.length(), 0};
167
+ auto upper_left_back = upper_right_back - Vec3{x.length(), 0, 0};
168
+
169
+ auto upper_right_front = max();
170
+ auto upper_left_front = upper_right_front - Vec3{x.length(), 0, 0};
171
+ auto lower_left_front = upper_left_front - Vec3{0, y.length(), 0};
172
+ auto lower_right_front = lower_left_front + Vec3{x.length(), 0, 0};
173
+
174
+ return {lower_left_back, lower_right_back, upper_right_back, upper_left_back,
175
+ lower_left_front, lower_right_front, upper_right_front, upper_left_front};
176
+ }
177
+
178
+ /// @brief Gets vertex indices of the quadrilateral faces of this bounding box
179
+ ///
180
+ /// Edges are returned in the following face order: front, right, back, left, bottom, and top
181
+ [[nodiscard]]
182
+ static constexpr std::array<std::array<uint8_t , 4>, 6> edges() {
183
+
184
+ using Face = std::array<uint8_t, 4>;
185
+
186
+ return {
187
+ Face{4, 5, 6, 7},
188
+ Face{5, 1, 2, 6},
189
+ Face{0, 1, 2, 3},
190
+ Face{0, 4, 7, 3},
191
+ Face{0, 1, 5, 4},
192
+ Face{6, 2, 3, 7}
193
+ };
194
+ }
195
+
196
+ [[nodiscard]]
197
+ Extent<T> extent(Direction dir) const {
198
+ if (dir == Direction::x) {
199
+ return x;
200
+ }
201
+ if (dir == Direction::y) {
202
+ return y;
203
+ }
204
+ if (dir == Direction::z) {
205
+ return z;
206
+ }
207
+ throw std::runtime_error(
208
+ std::format("Direction {} is not supported in the extent accessor",
209
+ std::underlying_type_t<Direction>(dir))
210
+ );
211
+ }
156
212
  };
157
213
 
158
214
  template<typename T>
@@ -1,4 +1,5 @@
1
1
  from __future__ import annotations
2
+ import pybind11_stubgen.typing_ext
2
3
  import typing
3
4
  __all__: list[str] = ['AABB', 'Extent', 'Identity2', 'Identity3', 'Identity4', 'LinearSystem2', 'LinearSystem3', 'LinearSystem4', 'Matrix2', 'Matrix3', 'Matrix4', 'Vector2', 'Vector3', 'Vector4', 'col_major', 'order', 'row_major']
4
5
  class AABB:
@@ -8,12 +9,29 @@ class AABB:
8
9
  @typing.overload
9
10
  def __init__(self, arg0: Extent, arg1: Extent, arg2: Extent) -> None:
10
11
  ...
12
+ @typing.overload
13
+ def __init__(self, arg0: Vector3, arg1: Vector3) -> None:
14
+ ...
11
15
  def __repr__(self) -> str:
12
16
  ...
13
17
  def __str__(self) -> str:
14
18
  ...
19
+ def corners(self) -> typing.Annotated[list[Vector3], pybind11_stubgen.typing_ext.FixedSize(8)]:
20
+ ...
21
+ def edges(self) -> typing.Annotated[list[typing.Annotated[list[int], pybind11_stubgen.typing_ext.FixedSize(4)]], pybind11_stubgen.typing_ext.FixedSize(6)]:
22
+ ...
23
+ def max(self) -> Vector3:
24
+ ...
15
25
  def merge(self, arg0: AABB) -> None:
16
26
  ...
27
+ def min(self) -> Vector3:
28
+ ...
29
+ def x_extent(self) -> Extent:
30
+ ...
31
+ def y_extent(self) -> Extent:
32
+ ...
33
+ def z_extent(self) -> Extent:
34
+ ...
17
35
  class Extent:
18
36
  max: float
19
37
  min: float
@@ -168,6 +186,8 @@ class Vector2:
168
186
  ...
169
187
  def __repr__(self) -> str:
170
188
  ...
189
+ def __rmul__(self, arg0: float) -> Vector2:
190
+ ...
171
191
  def __str__(self) -> str:
172
192
  ...
173
193
  def __sub__(self, arg0: Vector2) -> Vector2:
@@ -207,6 +227,8 @@ class Vector3:
207
227
  ...
208
228
  def __repr__(self) -> str:
209
229
  ...
230
+ def __rmul__(self, arg0: float) -> Vector3:
231
+ ...
210
232
  def __str__(self) -> str:
211
233
  ...
212
234
  def __sub__(self, arg0: Vector3) -> Vector3:
@@ -246,6 +268,8 @@ class Vector4:
246
268
  ...
247
269
  def __repr__(self) -> str:
248
270
  ...
271
+ def __rmul__(self, arg0: float) -> Vector4:
272
+ ...
249
273
  def __str__(self) -> str:
250
274
  ...
251
275
  def __sub__(self, arg0: Vector4) -> Vector4:
@@ -65,9 +65,33 @@ void bind_Bounds(py::module_ const& module, std::string_view className) {
65
65
  .def(py::init([](m3d::Extent<T> const& x, m3d::Extent<T> const& y, m3d::Extent<T> const& z) {
66
66
  return Bounds {x, y, z};
67
67
  }))
68
+ .def(py::init([](m3d::Vector3<T> const& min, m3d::Vector3<T> const& max) {
69
+ return Bounds(m3d::Extent<T>{min.x, max.x}, m3d::Extent<T>{min.y, max.y}, m3d::Extent<T>{min.z, max.z});
70
+ }))
71
+ .def("min", [](Bounds const& self) {
72
+ return self.min();
73
+ })
74
+ .def("max", [](Bounds const& self) {
75
+ return self.max();
76
+ })
77
+ .def("corners", [](Bounds const& self) {
78
+ return self.corners();
79
+ })
80
+ .def("edges", [](Bounds const& self) {
81
+ return self.edges();
82
+ })
68
83
  .def("merge", [](Bounds& self, Bounds const& another) {
69
84
  self.merge(another);
70
85
  })
86
+ .def("x_extent", [](Bounds const& self) {
87
+ return self.extent(Bounds::Direction::x);
88
+ })
89
+ .def("y_extent", [](Bounds const& self) {
90
+ return self.extent(Bounds::Direction::y);
91
+ })
92
+ .def("z_extent", [](Bounds const& self) {
93
+ return self.extent(Bounds::Direction::z);
94
+ })
71
95
  .def("__str__", [](Bounds const& bounds) {
72
96
  return bounds.asString();
73
97
  })
@@ -29,6 +29,7 @@ void bind_Vector(py::module_ const& module, char const* className) {
29
29
  .def(py::self + py::self)
30
30
  .def(py::self - py::self)
31
31
  .def(py::self * T{})
32
+ .def(T{} * py::self)
32
33
  .def(py::self / T{})
33
34
  .def("dot", &vector::dot)
34
35
  .def("normalize", [](vector& v) { v.normalize(); return v; })
@@ -4,7 +4,7 @@ build-backend = "scikit_build_core.build"
4
4
 
5
5
  [project]
6
6
  name = "math3d_py"
7
- version = "1.3.4"
7
+ version = "1.4.1"
8
8
  description = "Python bindings for 3dmath"
9
9
  authors = [{ name = "Murali Dhanakoti", email = "dhanakoti.murali@gmail.com" }]
10
10
  requires-python = ">=3.13,<3.14"
@@ -144,5 +144,13 @@ TEST(Bounds, Merging) {
144
144
  boundsA.merge(boundsB);
145
145
  ASSERT_NEAR((boundsA.min() - Vector3{-100, -10, -10}).lengthSquared(), 0, 1e-6);
146
146
  ASSERT_NEAR((boundsA.max() - Vector3{10, 200, 10}).lengthSquared(), 0, 1e-6);
147
+ }
147
148
 
149
+ TEST(Bounds, Corners) {
150
+ Bounds3D const bounds {{-10, -10, -10}, { 10, 10, 10}};
151
+ auto const corners = bounds.corners();
152
+ ASSERT_EQ((bounds.min() - corners.at(0)).lengthSquared(), 0);
153
+ ASSERT_EQ(((bounds.min() + Vector3{bounds.x.length(), bounds.y.length(), 0}) - corners.at(2)).lengthSquared(), 0);
154
+ ASSERT_EQ((bounds.max() - corners.at(6)).lengthSquared(), 0);
155
+ ASSERT_EQ(((bounds.max() - Vector3{bounds.x.length(), bounds.y.length(), 0}) - corners.at(4)).lengthSquared(), 0);
148
156
  }
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes