Constructive solid geometry

Typically they are the objects of simple shape: cuboids, cylinders, prisms, pyramids, spheres, cones.

It is used in cases where simple geometric objects are desired,[citation needed] or where mathematical accuracy is important.

[4] Nearly all engineering CAD packages use CSG (where it may be useful for representing tool cuts, and features where parts must fit together).

A resulting CSG tree is required to occupy the same volume in 3D space as the input mesh while having a minimal number of nodes.

Deductive methods solve this problem by building a set of half-spaces that describe the interior of the geometry.

[7] Another approach decouples the detection of primitive shapes and the computation of the CSG tree that defines the final model.

This approach exploits the ability of modern program synthesis tools to find a CSG tree with minimal complexity.

CSG objects can be represented by binary trees, where leaves represent primitives, and nodes represent operations. In this figure, the nodes are labeled for intersection , for union , and for difference .
CSG operations being applied in the context of rays in a ray tracer