Constructive Solid Geometry
Constructive Solid Geometry ( CSG ) or constructive solid geometry is a technique for modeling of bodies u. a. is used in 3D computer graphics and CAD programs. Constructive Solid Geometry enables a designer to create a complex shaped body by using Boolean operators to combine basic bodies into a new body. Bodies that emerged from the CSG often appear very complex, but in reality are nothing more than cleverly linked objects.
Base objects
The basic objects from which CSG bodies emerge are called primitives (cf. graphical primitive ). Typically, these are bodies whose surface can be described using a relatively simple mathematical formula, such as B. cubes , cylinders , prisms , pyramids , spheres or rings . The set of possible primitives is usually limited by the software used. Some software packages allow CSG on curved objects (procedural or parametric surfaces), while others only work on polygonal meshes (triangular networks). The procedural or parametric approach allows a mathematically exact calculation and representation of the bodies, while meshes are always only a more or less imprecise approximation of reality.
As mentioned earlier, a complex body is created from primitives linked by operations. Usually these are Boolean operations on sets: union (Union ), difference (Difference, ) and average (Intersection, ). The following figure shows the effect of the operators using the example of linking a cube with a sphere:
Applications
CSG is very popular among designers because of its ability to create complex geometries with a number of relatively simple bodies. The designer can (with most programs) change the geometry afterwards by changing the position (or transformation) of the individual objects or the Boolean operator with which the objects are connected. So the designer can create his model interactively and intuitively, through trial and error.
CSG is also used by various programs "under the hood", i. H. without the user being aware of the existence of the CSG operations. So use z. For example, the game engines from Unreal and Quake use the CSG process. Simulation programs that simulate the processes on machine tools use i. d. R. also CSG.
CSG tree
Since several CSG operations executed one after the other are generally not commutative, they can be arranged hierarchically and transferred to a CSG tree. Each leaf corresponds to a primitive, each node to a CSG operation (or the intermediate result from a CSG operation, which can be transformed again). The root of the tree is the end result.
The regularized amounts of the n-dimensional Euclidean space form with the links , , (complementary amount) of a Boolean algebra, for which the commutative law applies. The operator is not part of this Boolean algebra. However, the and operators can be used as a replacement for the operator:
- .
The example object can therefore also be calculated without brackets ( = cube, = sphere, = cylinder):
- .
See also
literature
- Christoph Martin Hoffmann: Geometric & Solid Modeling . Morgan Kaufmann Publishers, San Mateo, California 1989, ISBN 1-55860-067-1 .
- Martii Mäntylä: An Introduction to Solid Modeling . Computer Science Press, Rockville, Maryland 1988, ISBN 0-88175-108-1 .
Web links
- CSG-3MF Project - Open Source Library ( GPL ), C ++, COM based with C # script support.
- GNU Triangulated Surface library - Open Source ( LGPL ) library with CSG support for triangles
- Computational Geometry Algorithms Library - Open Source ( LGPL , GPL ) library which supports CSG, among others .
- The CSG rendering library - Open source library ( GPL, Version 2 ) with image-based CSG techniques via OpenGL.
- OpenSCAD - A simple CAD program for creating 3D objects based on CSG.
- HyperFun Project - A simple scripting language for performing CSG operations on various objects.
- Overview of CSG in avoCADo - open source 3D CAD software.
- SimpleGeo - Interactive CSG modeler for Monte Carlo particle transport simulations.
- FMEpedia CSGBuilder example - CSG using so-called FME (Feature Manipulation Engine).