CSG: difference

A difference creates a new solid by removing or carving space from an already existing solid. Any kind of solid shapes, no matter whether convex or not, can be used in a difference operation. Internally, XSight RT provides alternative classes for implementing special cases more efficiently.

Syntax

No matter what surface become visible, the result always uses the material from the first shape.

Operator syntax

As an alternative, the minus operator can be used to find the difference between two arbitrary shapes:

    box([-1.0, -1.0, -1.0], [1.0, 1.0, 1.0], plastic(blue)) -
        box([0.0, 0.0, 0.0], [1.1, 1.1, 1.1], plastic(red))

In this case, no material is specified.

Example

difference(
    box([-1.0, -1.0, -1.0], [1.0, 1.0, 1.0],
        metal(royalblue, 0.02, 0.0, 0.8, 1, 10)),
    box([ 0.0,  0.0,  0.0], [1.1, 1.1, 1.1]));

See also

Home | CSG operations | Intersection | Union | Cone | Cylinder | Sphere | Torus