solid.Shape.intersect
solid.Shape: C = intersect (A, B, …)
The intersection of shapes, the material common to all of them.
C = intersect (A, B, …) keeps only what
lies inside every shape given. Shapes that do not all meet, and an
empty shape among them, give the empty shape. The intersection of a
single shape is that shape.
Intersecting with a box trims a shape to the box, and intersecting two parts tells whether they collide: the volume of their intersection is the volume of the interference, and parts that stay apart give the empty shape. Each solid of the result takes the colour of the first coloured solid it came from.
A shape may hold solids that overlap, as the shape of an assembly does where its parts meet. After the first it counts as the region its solids cover together, and each solid of A is intersected on its own and kept apart from the others, so intersecting a part with the shape of the assembly round it gives the interference with all its parts at once.
## A shaft through a gear, and the same shaft moved clear of it gear = solid.cylinder (20, 5); shaft = translate (solid.cylinder (4, 30), [0, 0, -10]); volume (intersect (gear, shaft)) ⇒ 251.33 isempty (intersect (gear, translate (shaft, [30, 0, 0]))) ⇒ 1 |
See also: solid.Shape.union, solid.Shape.subtract
Source Code: solid.Shape