22.214.171.124 Inside and Outside
Most shape primitives, like spheres, boxes and blobs divide the world into two regions. One region is inside the
object and one is outside. Given any point in space you can say it is either inside or outside any particular
primitive object. Well, it could be exactly on the surface but this case is rather hard to determine due to numerical
Even planes have an inside and an outside. By definition, the surface normal of the plane points towards the
outside of the plane. You should note that triangles cannot be used as solid objects in CSG since they have no well
defined inside and outside. Triangle-based shapes (
mesh, mesh2) can only be used in CSG when they are
closed objects and have an inside vector specified.
Note:: Although triangles, bicubic_patches and some other shapes have no well defined
inside and outside, they have a front- and backside which makes it possible to use a texture on the front side and an
interior_texture on the back side.
CSG uses the concepts of inside and outside to combine shapes together as explained in the following sections.
Imagine you have two objects that partially overlap like shown in the figure below. Four different areas of points
can be distinguished: points that are neither in object
A nor in object
B, points that are
A but not in object
B, points that are not in object
A but in object
and last not least points that are in object
A and object
Keeping this in mind it will be quite easy to understand how the CSG operations work.
When using CSG it is often useful to invert an object so that it will be inside-out. The appearance of the object
is not changed, just the way that POV-Ray perceives it. When the
inverse keyword is used the inside
of the shape is flipped to become the outside and vice versa.
The inside/outside distinction is not important for a
union, but is important for
merge.Therefore any objects may be combined using
only solid objects, i.e. objects that have a well-defined interior can be used in the other kinds of CSG. The objects
described in "Finite Patch Primitives" have no well defined inside/outside. All objects described in the
sections "Finite Solid Primitives" and "Infinite Solid Primitives".