Skip to content

Commit a4b78c0

Browse files
committed
latest polyhedron implementations
1 parent c1584f7 commit a4b78c0

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/compas/geometry/polyhedron.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -578,8 +578,8 @@ def boolean_union(self, other):
578578
Examples
579579
--------
580580
>>> from compas.geometry import Box, Sphere
581-
>>> A = Box(2).to_polyhedron()
582-
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(u=16)
581+
>>> A = Box(2).to_polyhedron(triangulated=True)
582+
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(triangulated=True)
583583
>>> C = A.boolean_union(B)
584584
585585
"""
@@ -607,8 +607,8 @@ def boolean_difference(self, other):
607607
Examples
608608
--------
609609
>>> from compas.geometry import Box, Sphere
610-
>>> A = Box(2).to_polyhedron()
611-
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(u=16)
610+
>>> A = Box(2).to_polyhedron(triangulated=True)
611+
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(triangulated=True)
612612
>>> C = A.boolean_difference(B)
613613
614614
"""
@@ -636,8 +636,8 @@ def boolean_intersection(self, other):
636636
Examples
637637
--------
638638
>>> from compas.geometry import Box, Sphere
639-
>>> A = Box(2).to_polyhedron()
640-
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(u=16)
639+
>>> A = Box(2).to_polyhedron(triangulated=True)
640+
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(triangulated=True)
641641
>>> C = A.boolean_intersection(B)
642642
643643
"""

src/compas/geometry/shapes/shape.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ def frame(self): # type: () -> Frame
8282
return self._frame
8383

8484
@frame.setter
85-
def frame(self, frame): # type: (Frame) -> None
85+
def frame(self, frame): # type: (Frame | None) -> None
8686
if not frame:
8787
self._frame = None
8888
else:
@@ -167,7 +167,7 @@ def lines(self): # type: () -> list[Line]
167167
@property
168168
def polygons(self): # type: () -> list[Polygon]
169169
vertices = self.compute_vertices()
170-
return [[Polygon([vertices[v] for v in face])] for face in self.faces]
170+
return [Polygon([vertices[v] for v in face]) for face in self.faces]
171171

172172
# =============================================================================
173173
# Constructors
@@ -225,7 +225,7 @@ def compute_triangles(self): # type: () -> list[tuple[int, int, int]]
225225
# =============================================================================
226226

227227
def to_vertices_and_faces(self, triangulated=False, u=None, v=None):
228-
# type: (bool, int | None, int | None) -> tuple[list[list[float]], list[list[int]]]
228+
# type: (bool, int | None, int | None) -> tuple[list[list[float]], list[list[int]] | list[tuple[int, int, int]]]
229229
"""Convert the shape to a list of vertices and faces.
230230
231231
Parameters

0 commit comments

Comments
 (0)