solid.Shape

Methods

Method Reference: 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 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