File tree Expand file tree Collapse file tree 1 file changed +38
-0
lines changed
src/compas/geometry/shapes Expand file tree Collapse file tree 1 file changed +38
-0
lines changed Original file line number Diff line number Diff line change @@ -68,6 +68,25 @@ def __sub__(self, other):
6868 return Polyhedron (V , F )
6969
7070 def __and__ (self , other ):
71+ """Compute the boolean intersection using the "&" operator of this shape and another.
72+
73+ Parameters
74+ ----------
75+ other : :class:`Solid`
76+ The solid to intersect with.
77+
78+ Returns
79+ -------
80+ :class:`Solid`
81+ The resulting solid.
82+
83+ Examples
84+ --------
85+ >>> from compas.geometry import Box, Sphere
86+ >>> A = Box.from_width_height_depth(2, 2, 2)
87+ >>> B = Sphere([1, 1, 1], 1.0)
88+ >>> C = A & B
89+ """
7190 from compas .geometry import boolean_intersection_mesh_mesh
7291 from compas .geometry import Polyhedron
7392 A = self .to_vertices_and_faces (triangulated = True )
@@ -76,4 +95,23 @@ def __and__(self, other):
7695 return Polyhedron (V , F )
7796
7897 def __or__ (self , other ):
98+ """Compute the boolean union using the "|" operator of this shape and another.
99+
100+ Parameters
101+ ----------
102+ other : :class:`Solid`
103+ The solid to add.
104+
105+ Returns
106+ -------
107+ :class:`Solid`
108+ The resulting solid.
109+
110+ Examples
111+ --------
112+ >>> from compas.geometry import Box, Sphere
113+ >>> A = Box.from_width_height_depth(2, 2, 2)
114+ >>> B = Sphere([1, 1, 1], 1.0)
115+ >>> C = A | B
116+ """
79117 return self .__add__ (other )
You can’t perform that action at this time.
0 commit comments