Skip to content

Commit

Permalink
latest polyhedron implementations
Browse files Browse the repository at this point in the history
  • Loading branch information
tomvanmele committed Jul 2, 2024
1 parent c1584f7 commit a4b78c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
12 changes: 6 additions & 6 deletions src/compas/geometry/polyhedron.py
Original file line number Diff line number Diff line change
Expand Up @@ -578,8 +578,8 @@ def boolean_union(self, other):
Examples
--------
>>> from compas.geometry import Box, Sphere
>>> A = Box(2).to_polyhedron()
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(u=16)
>>> A = Box(2).to_polyhedron(triangulated=True)
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(triangulated=True)
>>> C = A.boolean_union(B)
"""
Expand Down Expand Up @@ -607,8 +607,8 @@ def boolean_difference(self, other):
Examples
--------
>>> from compas.geometry import Box, Sphere
>>> A = Box(2).to_polyhedron()
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(u=16)
>>> A = Box(2).to_polyhedron(triangulated=True)
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(triangulated=True)
>>> C = A.boolean_difference(B)
"""
Expand Down Expand Up @@ -636,8 +636,8 @@ def boolean_intersection(self, other):
Examples
--------
>>> from compas.geometry import Box, Sphere
>>> A = Box(2).to_polyhedron()
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(u=16)
>>> A = Box(2).to_polyhedron(triangulated=True)
>>> B = Sphere(point=[1, 1, 1], radius=1.0).to_polyhedron(triangulated=True)
>>> C = A.boolean_intersection(B)
"""
Expand Down
6 changes: 3 additions & 3 deletions src/compas/geometry/shapes/shape.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ def frame(self): # type: () -> Frame
return self._frame

@frame.setter
def frame(self, frame): # type: (Frame) -> None
def frame(self, frame): # type: (Frame | None) -> None
if not frame:
self._frame = None
else:
Expand Down Expand Up @@ -167,7 +167,7 @@ def lines(self): # type: () -> list[Line]
@property
def polygons(self): # type: () -> list[Polygon]
vertices = self.compute_vertices()
return [[Polygon([vertices[v] for v in face])] for face in self.faces]
return [Polygon([vertices[v] for v in face]) for face in self.faces]

# =============================================================================
# Constructors
Expand Down Expand Up @@ -225,7 +225,7 @@ def compute_triangles(self): # type: () -> list[tuple[int, int, int]]
# =============================================================================

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

0 comments on commit a4b78c0

Please sign in to comment.