Constructive solid geometry
From Wikipedia, the free encyclopedia
Constructive solid geometry (CSG) is a technique used in solid modeling. CSG is often, but not always, a procedural modeling technique used in 3D computer graphics and CAD. Constructive solid geometry allows a modeler to create a complex surface or object by using Boolean operators to combine objects. Often CSG presents a model or surface that appears visually complex, but is actually little more than cleverly combined or decombined objects. (In some cases, constructive solid geometry is performed on polygonal meshes, and may or may not be procedural and/or parametric.)
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 is limited by each software package. Some software packages allow CSG on curved objects while other packages do not.
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.
A primitive 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:
Combining these elementary operations, it is possible to build up objects with high complexity starting from simple ones.
[edit] Applications of CSG
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 engine uses this system, as does Hammer (the native Source engine level editor), and Torque Game Engine/Torque Game Engine Advanced. CSG is popular because a modeler can use a set of relatively simple objects to create very complicated geometry. When CSG is procedural or parametric, the user can revise their complex geometry by changing the position of objects or by changing the Boolean operation used to combine those objects.
One of the advantages of CSG is that it can easily assure that objects are "solid" or water-tight if all of the primitive shapes are water-tight. This can be important for some manufacturing or engineering computation applications. By comparison, when creating geometry based upon boundary representations, additional topological data is required, or consistency checks must be performed to assure that the given boundary description specifies a valid solid object.
A convenient property of CSG shapes is that it is easy to classify arbitrary points as being either inside or outside the shape created by CSG. The point is simply classified against all the underlying primitives and the boolean equation is evaluated. This is a desirable quality for some applications such as collision detection.
[edit] Applications with CSG support
- BRL-CAD
- Feature Manipulation Engine
- GtkRadiant
- POV-Ray
- SolidWorks mechanical CAD suite
- UnrealEd
[edit] External links
- Leadwerks Software 'What is Constructive Solid Geometry?' - explanation of CSG definitions, equations, techniques, and uses.
- GNU Triangulated Surface library - an opensource (LGPL) library featuring CSG capabilities on triangle meshes.
- Computational Geometry Algorithms Library - an opensource (LGPL, QPL) library featuring, among other, CSG capabilities.
- The CSG rendering library - an opensource (GPL, Version 2 you can ask for a separate license) library that does image-based CSG rendering using OpenGL.
- HyperFun Project - a simple geometric modeling functional language able to perform CSG operations on various types of objects.
- Overview of CSG in avoCADo - a recent opensource 3D CAD program.
- SimpleGeo - interactive solid modeling for Monte Carlo particle transport simulations.
- FMEpedia CSGBuilder example - wikipedia CSG binary tree as replicated using FME (Feature Manipulation Engine).
- SolidKit Library - programming library for 3D/2D graphics applications development in C++ using OpenGL, featuring CSG capabilities on triangle meshes.