POV-Ray : Documentation : 2.4.6.4 Difference
  POV-Ray 3.6 Documentation Online View  
2.4.6.3 Intersection   2.4.6.5 Merge

2.4.6.4 Difference

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.

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 }
  }
2.4.6.3 Intersection   2.4.6.5 Merge


Copyright 2003-2021 Persistence of Vision Raytracer Pty. Ltd.