Difference
Reference

From POV-Wiki
Jump to: navigation, search

The CSG difference operation takes the intersection between the first object and the inverse of all subsequent objects. Thus only points inside object A and outside object B belong to the difference of both objects.

The result is a subtraction of the 2nd shape from the first shape as shown in the figure below.

RefImgDiffobj.gif

The difference between two objects.

The syntax is:

DIFFERENCE:
  difference {
    SOLID_OBJECTS...
    [OBJECT_MODIFIERS...]
    }

The component objects must have well defined inside/outside properties. Patch objects are not allowed.

Note: If the first object is entirely inside the subtracted objects, the difference object disappears.

Here is an example of a properly formed difference:

difference {
  box { <-1.5, -1, -1>, <0.5, 1, 1> }
  cylinder { <0.5, 0, -1>, <0.5, 0, 1>, 1 }
  }

Note: Internally, POV-Ray simply adds the inverse keyword to the second (and subsequent) objects and then performs an intersection.

The example above is equivalent to:

intersection {
  box { <-1.5, -1, -1>, <0.5, 1, 1> }
  cylinder { <0.5, 0, -1>, <0.5, 0, 1>, 1 inverse }
  }
Personal tools
Namespaces
Variants
Actions
Content
Other Pages
Toolbox