Skip to content

Commit 58f93c5

Browse files
committed
add docstrings
1 parent 2682eeb commit 58f93c5

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

src/compas/geometry/shapes/_shape.py

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff 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)

0 commit comments

Comments
 (0)