7. Constructive Solid Geometry - Building blocks put together
Constructive solid geometry or CSG allows us to play around with our
primitives and build complex objects. CSG supports union, intersection
and difference of two or more objects. Essentially a CSG tree gets built for
each CSG object with the nodes being the primitives or CSG subtrees
themselves. The various CSG operations are explained below.
- Union -
An union CSG object C (where C = A union B) will contain all the points which
belong to A OR B. A sample union specification is shown below -
|
Figure 7 |
union
{
  object
   {
    surface { ... }
    sphere { ... }
    transform
   }
  object
   {
    surface { ... }
    cylinder { ... }
    transform
   }
}
The union can be of two primitives or of two CSG objects themselves or any
combination thereof. The CSG tree which gets formed as a result of the above
code is also shown. Some examples of CSG union are shown below -
|
|
|
Sphere & Cylinder |
Sphere & Cone |
Cylinder & (Sphere & Cylinder) |
- Intersection -
An intersection CSG object C (where C = A intersection B) will contain all
the points which belong to A AND B. Intersection is specified exactly
in the same manner as an union and the tree formed is also similar. Some
examples of CSG intersection are shown below -
|
Sphere & Cylinder |
- Difference -
A Difference CSG object C (where C = A difference B) will contain all
the points which belong to A AND (NOT B). Difference is specified exactly
in the same manner as an union and the tree formed is also similar. Some
examples of CSG difference are shown below -
|
Sphere & Cylinder |
[ Back ]
Page last updated on 04 October, 2005.
|
AT cse.iitd.ac.in
|
© Parag Chaudhuri , 2009
|
|