Constructive solid geometry
Encyclopedia
Constructive solid geometry (CSG) is a technique used in solid modeling
. Constructive solid geometry allows a modeler to create a complex surface or object by using Boolean operator
s 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 3D computer graphics
and CAD CSG is often used in procedural modeling. CSG can also be performed on polygonal meshes
, and may or may not be procedural and/or parametric.
s, cylinder
s, prism
s, pyramids
, sphere
s, cone
s. 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 parameter
s; 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.
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 representation
s, 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 resulting boolean expression is evaluated. This is a desirable quality for some applications such as collision detection
.
Solid modeling
Solid modeling is a consistent set of principles for mathematical and computer modeling of three dimensional solids. Solid modeling is distinguished from related areas of Geometric modeling and Computer graphics by its emphasis on physical fidelity...
. Constructive solid geometry allows a modeler to create a complex surface or object by using Boolean operator
Operator (programming)
Programming languages typically support a set of operators: operations which differ from the language's functions in calling syntax and/or argument passing mode. Common examples that differ by syntax are mathematical arithmetic operations, e.g...
s 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 3D computer graphics
3D computer graphics
3D computer graphics are graphics that use a three-dimensional representation of geometric data that is stored in the computer for the purposes of performing calculations and rendering 2D images...
and CAD CSG is often used in procedural modeling. CSG can also be performed on polygonal meshes
Polygon mesh
A polygon mesh or unstructured grid is a collection of vertices, edges and faces that defines the shape of a polyhedral object in 3D computer graphics and solid modeling...
, and may or may not be procedural and/or parametric.
Workings of CSG
The simplest solid objects used for the representation are called primitives. Typically they are the objects of simple shape: cuboidCuboid
In geometry, a cuboid is a solid figure bounded by six faces, forming a convex polyhedron. There are two competing definitions of a cuboid in mathematical literature...
s, cylinder
Cylinder (geometry)
A cylinder is one of the most basic curvilinear geometric shapes, the surface formed by the points at a fixed distance from a given line segment, the axis of the cylinder. The solid enclosed by this surface and by two planes perpendicular to the axis is also called a cylinder...
s, prism
Prism (geometry)
In geometry, a prism is a polyhedron with an n-sided polygonal base, a translated copy , and n other faces joining corresponding sides of the two bases. All cross-sections parallel to the base faces are the same. Prisms are named for their base, so a prism with a pentagonal base is called a...
s, pyramids
Pyramid (geometry)
In geometry, a pyramid is a polyhedron formed by connecting a polygonal base and a point, called the apex. Each base edge and apex form a triangle. It is a conic solid with polygonal base....
, sphere
Sphere
A sphere is a perfectly round geometrical object in three-dimensional space, such as the shape of a round ball. Like a circle in two dimensions, a perfect sphere is completely symmetrical around its center, with all points on the surface lying the same distance r from the center point...
s, cone
Cone (geometry)
A cone is an n-dimensional geometric shape that tapers smoothly from a base to a point called the apex or vertex. Formally, it is the solid figure formed by the locus of all straight line segments that join the apex to the base...
s. 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
Boolean logic
Boolean algebra is a logical calculus of truth values, developed by George Boole in the 1840s. It resembles the algebra of real numbers, but with the numeric operations of multiplication xy, addition x + y, and negation −x replaced by the respective logical operations of...
operations
Operation (mathematics)
The general operation as explained on this page should not be confused with the more specific operators on vector spaces. For a notion in elementary mathematics, see arithmetic operation....
on sets
Set theory
Set theory is the branch of mathematics that studies sets, which are collections of objects. Although any type of object can be collected into a set, set theory is applied most often to objects that are relevant to mathematics...
: union
Union (set theory)
In set theory, the union of a collection of sets is the set of all distinct elements in the collection. The union of a collection of sets S_1, S_2, S_3, \dots , S_n\,\! gives a set S_1 \cup S_2 \cup S_3 \cup \dots \cup S_n.- Definition :...
, intersection
Intersection (set theory)
In mathematics, the intersection of two sets A and B is the set that contains all elements of A that also belong to B , but no other elements....
and difference
Complement (set theory)
In set theory, a complement of a set A refers to things not in , A. The relative complement of A with respect to a set B, is the set of elements in B but not in A...
.
A primitive can typically be described by a procedure
Algorithm
In mathematics and computer science, an algorithm is an effective method expressed as a finite list of well-defined instructions for calculating a function. Algorithms are used for calculation, data processing, and automated reasoning...
which accepts some number of parameter
Parameter
Parameter from Ancient Greek παρά also “para” meaning “beside, subsidiary” and μέτρον also “metron” meaning “measure”, can be interpreted in mathematics, logic, linguistics, environmental science and other disciplines....
s; 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. |
Combining these elementary operations, it is possible to build up objects with high complexity starting from simple ones.
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 engineUnreal Engine
The Unreal Engine is a game engine developed by Epic Games, first illustrated in the 1998 first-person shooter game Unreal. Although primarily developed for first-person shooters, it has been successfully used in a variety of other genres, including stealth, MMORPGs and RPGs...
uses this system, as does Hammer
Valve Hammer Editor
Valve Hammer Editor, formerly known as Worldcraft and now commonly called Hammer, is Valve Software's map creation program for their game engine, Source. Old versions of Worldcraft also supported Quake and Quake II. Versions prior to 4 supported exclusively GoldSrc, Source's predecessor. The...
(the native Source engine
Source engine
Source is a 3D game engine developed by Valve Corporation. It debuted in June 2004 with Counter-Strike: Source and shortly thereafter Half-Life 2, and has been in active development ever since...
level editor), and Torque Game Engine
Torque Game Engine
The Torque Game Engine, or TGE, is a 3D computer game engine originally developed by Dynamix for the 2001 FPS Tribes 2. The Torque engine and its many derivative products are available for license from GarageGames, a company formed by many members of the Tribes 2 team at Dynamix...
/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 representation
Boundary representation
In solid modeling and computer-aided design, boundary representation—often abbreviated as B-rep or BREP—is a method for representing shapes using the limits...
s, 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 resulting boolean expression is evaluated. This is a desirable quality for some applications such as collision detection
Collision detection
Collision detection typically refers to the computational problem of detecting the intersection of two or more objects. While the topic is most often associated with its use in video games and other physical simulations, it also has applications in robotics...
.
Applications with CSG support
- 3D World Studio3D World Studio3D World Studio is a map/level editor for use with Torque Game Engine, DarkBasic Pro, Leadwerks Engine and Blitz3D. The program is developed by Leadwerks Software and is distributed by both Leadwerks Software and The Game Creators in a Standard Edition and a Builder Edition.Both editions include...
- 3Delight3Delight3Delight is a proprietary, photorealistic, RenderMan-compliant offline renderer.It is developed by DNA Research, or DNA in short, a subsidiary of Taarna Studios.-Features:...
- Blender (provides meta objects)Blender (software)Blender is a free and open-source 3D computer graphics software product used for creating animated films, visual effects, interactive 3D applications or video games. The current release version is 2.60, and was released on October 19, 2011...
- BRL-CADBRL-CADBRL-CAD is a constructive solid geometry solid modeling computer-aided design system. It includes an interactive geometry editor, ray tracing support for graphics rendering and geometric analysis, computer network distributed framebuffer support, scripting, image-processing and signal-processing...
- Carve CSG - a fast and robust constructive solid geometry library
- NETGEN - an automatic 3d tetrahedral mesh generator. It accepts input from constructive solid geometry (CSG) or boundary representation (BRep)
- sgCore C++/C# library
- Feature Manipulation EngineFeature Manipulation EngineFME is an integrated collection of Spatial ETL tools for spatial data transformation and data translation produced by Safe Software Inc. of Surrey, British Columbia, Canada...
- FreeCADFreeCADFreeCAD is a general purpose 3D CAD modeler. It is free software . FreeCAD is aimed directly at mechanical engineering and product design but also fits in a wider range of uses around engineering, such as architecture or other engineering specialties.FreeCAD features tools similar to CATIA,...
- GtkRadiantGtkRadiantGtkRadiant is a level design program developed by id Software and Loki Software. It is used to create maps for a number of video games. It is maintained by id Software together with a number of volunteers.-History:...
- Java3D implementation: http://unbboolean.sourceforge.net/
- OpenSCADOpenSCADOpenSCAD is a free software application for creating solid 3D CAD objects. It is not an interactive modeler, but rather a 3D-compiler. OpenSCAD reads from a script and renders a 3D model from it. OpenSCAD is available for Windows, Linux and Mac OS X. It does constructive solid geometry...
- PhotoRealistic RenderManPhotoRealistic RenderManPhotoRealistic RenderMan, or PRMan for short, is a proprietary photorealistic RenderMan-compliant renderer.It primarily uses the Reyes algorithm but is also fully capable of doing ray tracing and global illumination....
- POV-RayPOV-RayThe Persistence of Vision Raytracer, or POV-Ray, is a ray tracing program available for a variety of computer platforms. It was originally based on DKBTrace, written by David Kirk Buck and Aaron A. Collins. There are also influences from the earlier Polyray raytracer contributed by its author...
- SimpleGeo
- SketchUp ProSketchUpSketchUp is a 3D modeling program marketed by Google and designed for architectural, civil, and mechanical engineers as well as filmmakers, game developers,...
(version 8 and higher) - SolidWorksSolidWorksSolidWorks is a 3D mechanical CAD program that runs on Microsoft Windows and is being developed by Dassault Systèmes SolidWorks Corp., a subsidiary of Dassault Systèmes, S. A. . SolidWorks is currently used by over 1.3 million engineers and designers at more than 130,000 companies worldwide...
mechanical CAD suite - UnrealEdUnrealEdUnrealEd is the level editor used to create levels for Unreal. It was also used for other games based on the Unreal engine, such as Deus Ex and Lineage II, although it has changed along with the engine for later games...
- VectorworksVectorWorksVectorworks is a computer-aided design and Building Information Modeling software program developed by Nemetschek Vectorworks that is used for drafting, technical drawing and 3D modeling. Vectorworks offers 2D, 3D, production management, and presentation capabilities for all phases of the design...
External links
- Leadwerks Software 'What is Constructive Solid Geometry?' - explanation of CSG definitions, equations, techniques, and uses.