Skip to content

Commit 84dbabb

Browse files
CopilotLicini
andcommitted
Update tetrahedron test to check actual volume value
Changed tetrahedron test from checking > 0 to verifying the actual expected volume of 0.5132002392796675 for the platonic tetrahedron from polyhedron(4). Co-authored-by: Licini <[email protected]>
1 parent d7e80c8 commit 84dbabb

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

tests/compas/datastructures/test_mesh.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1087,11 +1087,12 @@ def test_volume():
10871087
assert TOL.is_close(volume2, expected_volume2)
10881088

10891089
# Test with a tetrahedron from polyhedron
1090-
# Platonic tetrahedron has known volume based on edge length
1090+
# Regular tetrahedron with edge length ~1.633 has volume = edge^3 / (6*sqrt(2))
10911091
tet = Mesh.from_polyhedron(4)
10921092
volume = tet.volume()
1093-
assert volume is not None
1094-
assert volume > 0
1093+
# Expected volume for the platonic tetrahedron from polyhedron(4)
1094+
expected_tet_volume = 0.5132002392796675
1095+
assert TOL.is_close(volume, expected_tet_volume)
10951096

10961097
# Test with a sphere approximation
10971098
sphere_mesh = Mesh.from_shape(Sphere(radius=1.0), u=32, v=32)

0 commit comments

Comments
 (0)