| |||||||||
Constructive solid geometry (CSG) is a branch of solid modelling that deals with representations of a solid object as a combination of simpler solid objects. It is a procedural modelling technique used in 3D computer graphics and CAD.
The simplest solid objects used for the representation are called primitives. Typically they are the objects of simple shape: cuboids, cylinders, prisms, pyramids, spheres, cones. The set of allowable primitives may be restricted; e.g., curved shapes may be forbidden.
It is said that an object is constructed from primitives by means of allowable operations, which are typically Boolean operations on sets: union, intersection and difference.
In modelling packages, basic geometric objects such as the cube or 'box', sphere or ellipse, torus, and a number of other shapes that can be described using a mathematical formula, are commonly known as primitives. These objects can typically be described by a procedure which accepts some number of parameters; for example, a sphere may be described by the coordinates of its center point, along with a radius value. These primitives can be combined into compound objects using operations like these:
| Boolean union | Boolean difference | Boolean intersection |
|---|---|---|
| The merger of two objects into one. | The subtraction of one object from another. | The portion common to both objects. |
Constructive solid geometry has a number of practical uses. It is used in cases where simple geometric objects are desired, or where mathematical accuracy is important. The "Unreal" game engine uses this system.