File tree Expand file tree Collapse file tree 9 files changed +72
-4
lines changed
src/compas/geometry/shapes Expand file tree Collapse file tree 9 files changed +72
-4
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1212### Changed
1313
1414* Fixed bug in ` VolMesh.delete_cell ` .
15+ * Fixed ` NoneType ` error when calling ` compas.geometry.Sphere.edges ` .
16+
1517
1618### Removed
1719
Original file line number Diff line number Diff line change @@ -297,7 +297,7 @@ def compute_faces(self): # type: () -> list[list[int]]
297297 if v % 2 == 1 :
298298 v += 1
299299
300- vertices = self ._vertices
300+ vertices = self .vertices
301301
302302 faces = []
303303
Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ def compute_faces(self): # type: () -> list[list[int]]
267267 list[list[int]]
268268
269269 """
270- vertices = self ._vertices
270+ vertices = self .vertices
271271
272272 faces = []
273273 first = 0
Original file line number Diff line number Diff line change @@ -267,7 +267,7 @@ def compute_faces(self): # type: () -> list[list[int]]
267267 """
268268 u = self .resolution_u
269269
270- vertices = self ._vertices
270+ vertices = self .vertices
271271
272272 faces = []
273273 # side faces
Original file line number Diff line number Diff line change @@ -218,7 +218,7 @@ def compute_faces(self): # type: () -> list[list[int]]
218218 u = self .resolution_u
219219 v = self .resolution_v
220220
221- vertices = self ._vertices
221+ vertices = self .vertices
222222
223223 faces = []
224224
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from compas .geometry import Capsule
4+
5+
6+ @pytest .fixture
7+ def capsule ():
8+ return Capsule (123.0 , 13.0 )
9+
10+
11+ def test_capsule_discretization (capsule ):
12+ # just checking these don't break. Could not quickly find a formula that worked to test the actual values
13+ # as function of the resolution
14+ assert capsule .edges
15+ assert capsule .faces
16+ assert capsule .vertices
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from compas .geometry import Cone
4+
5+
6+ @pytest .fixture
7+ def cone ():
8+ return Cone (432.0 , 123.0 )
9+
10+
11+ def test_cone_discretization (cone ):
12+ # just checking these don't break. Could not quickly find a formula that worked to test the actual values
13+ # as function of the resolution
14+ assert cone .edges
15+ assert cone .faces
16+ assert cone .vertices
Original file line number Diff line number Diff line change 1+ import pytest
2+ from compas .geometry import Cylinder
3+
4+
5+ @pytest .fixture
6+ def cylinder ():
7+ return Cylinder (radius = 0.3 , height = 1.6 )
8+
9+
10+ def test_cylinder_discretization (cylinder ):
11+ # just checking these don't break. Could not quickly find a formula that worked to test the actual values
12+ # as function of the resolution
13+ assert cylinder .edges
14+ assert cylinder .faces
15+ assert cylinder .vertices
Original file line number Diff line number Diff line change 1+ import pytest
2+
3+ from compas .geometry import Frame
4+ from compas .geometry import Sphere
5+
6+
7+ @pytest .fixture
8+ def sphere ():
9+ return Sphere (450.0 , Frame .worldXY ())
10+
11+
12+ def test_sphere_discretization (sphere ):
13+ expected_face_count = sphere .resolution_v * sphere .resolution_u
14+ expected_vertex_count = (sphere .resolution_v - 1 ) * sphere .resolution_u + 2
15+ expected_edge_count = expected_face_count * 2 - sphere .resolution_u
16+
17+ assert len (sphere .edges ) == expected_edge_count
18+ assert len (sphere .faces ) == expected_face_count
19+ assert len (sphere .vertices ) == expected_vertex_count
You can’t perform that action at this time.
0 commit comments