mathutils -> numpy - polyline, rectangle #5192

This commit is contained in:
Andrej730
2024-12-13 19:07:42 +05:00
parent bd0cf6cf3f
commit 63f56d2f21
2 changed files with 71 additions and 58 deletions
@@ -25,6 +25,23 @@ from math import degrees, radians, tan
from mathutils import Vector
class TestRectangle(test.bootstrap.IFC4):
def test_get_rectangle_coords(self):
builder = ShapeBuilder(self.file)
# 2D.
coords = builder.get_rectangle_coords((1, 2), (3, 4))
assert np.allclose(coords, [[3.0, 4.0], [4.0, 4.0], [4.0, 6.0], [3.0, 6.0]])
# 3D, XY plane.
coords = builder.get_rectangle_coords((1, 2, 0), (3, 4, 0))
assert np.allclose(coords, [[3.0, 4.0, 0.0], [4.0, 4.0, 0.0], [4.0, 6.0, 0.0], [3.0, 6.0, 0.0]])
# 3D, XZ plane.
coords = builder.get_rectangle_coords((1, 0, 2), (3, 0, 4))
assert np.allclose(coords, [[3.0, 0.0, 4.0], [4.0, 0.0, 4.0], [4.0, 0.0, 6.0], [3.0, 0.0, 6.0]])
class TestCreatePolyline(test.bootstrap.IFC4):
def test_simple_polyline(self):
builder = ShapeBuilder(self.file)