File tree Expand file tree Collapse file tree 2 files changed +5
-5
lines changed
src/compas/datastructures/mesh
tests/compas/datastructures Expand file tree Collapse file tree 2 files changed +5
-5
lines changed Original file line number Diff line number Diff line change 3939from compas .geometry import centroid_points
4040from compas .geometry import centroid_polygon
4141from compas .geometry import cross_vectors
42- from compas .geometry import dot_vectors
4342from compas .geometry import distance_line_line
4443from compas .geometry import distance_point_plane
4544from compas .geometry import distance_point_point
45+ from compas .geometry import dot_vectors
4646from compas .geometry import length_vector
4747from compas .geometry import midpoint_line
4848from compas .geometry import normal_polygon
@@ -3917,7 +3917,7 @@ def volume(self):
39173917 vertices = self .face_vertices (fkey )
39183918 # Get coordinates for all vertices of the face
39193919 coords = [self .vertex_coordinates (v ) for v in vertices ]
3920-
3920+
39213921 # Triangulate the face if it has more than 3 vertices
39223922 if len (coords ) == 3 :
39233923 triangles = [coords ]
@@ -3926,7 +3926,7 @@ def volume(self):
39263926 triangles = []
39273927 for i in range (1 , len (coords ) - 1 ):
39283928 triangles .append ([coords [0 ], coords [i ], coords [i + 1 ]])
3929-
3929+
39303930 # Calculate signed volume contribution from each triangle
39313931 for triangle in triangles :
39323932 # Signed volume of tetrahedron formed by triangle and origin
Original file line number Diff line number Diff line change @@ -1071,7 +1071,7 @@ def test_normal():
10711071
10721072def test_volume ():
10731073 import math
1074-
1074+
10751075 # Test with a cube
10761076 mesh = Mesh .from_stl (compas .get ("cube_binary.stl" ))
10771077 volume = mesh .volume ()
@@ -1095,7 +1095,7 @@ def test_volume():
10951095 sphere_mesh = Mesh .from_shape (Sphere (radius = 1.0 ), u = 32 , v = 32 )
10961096 volume = sphere_mesh .volume ()
10971097 assert volume is not None
1098- expected_sphere_volume = (4.0 / 3.0 ) * math .pi * (1.0 ** 3 )
1098+ expected_sphere_volume = (4.0 / 3.0 ) * math .pi * (1.0 ** 3 )
10991099 # Allow for ~1% error due to discretization
11001100 assert TOL .is_close (volume , expected_sphere_volume , rtol = 0.02 )
11011101
You can’t perform that action at this time.
0 commit comments