Skip to content

Commit b261d8b

Browse files
add test function for bounding box computations
1 parent 45e900e commit b261d8b

File tree

1 file changed

+23
-0
lines changed

1 file changed

+23
-0
lines changed

tests/compas/datastructures/test_mesh.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1281,3 +1281,26 @@ def test_face_attributes_includes_all_defaults(box):
12811281
]
12821282

12831283
assert box.face_attribute(random_fkey, "attr3") == "value3"
1284+
1285+
1286+
# --------------------------------------------------------------------------
1287+
# bounding volumes
1288+
# --------------------------------------------------------------------------
1289+
1290+
1291+
def test_compute_aabb():
1292+
mesh = Mesh.from_obj(compas.get("tubemesh.obj"))
1293+
aabb = mesh.compute_aabb()
1294+
1295+
assert isinstance(aabb, Box)
1296+
assert len(aabb.points) == 8
1297+
assert aabb.contains_points(mesh.to_points())
1298+
1299+
1300+
def test_compute_obb():
1301+
mesh = Mesh.from_obj(compas.get("tubemesh.obj"))
1302+
obb = mesh.compute_obb()
1303+
1304+
assert isinstance(obb, Box)
1305+
assert len(obb.points) == 8
1306+
assert obb.contains_points(mesh.to_points())

0 commit comments

Comments
 (0)