Clipping

To cut off unwanted part from a shape, use clipped_by {}:

clipped_by {
     a shape such as sphere, box and so on
}
An object or a shape using clipped_by {} will cause all parts of the object/shape outside of the clipping shape removed. For example, if we have
box {
     < -1, -1, -1 >, < 1, 1, 1 >
     clipped_by {
          sphere { 0*x, 1.45 }
     }
     // pigment and finish
}
the result is a box whose eight corners are cut off by the clipping sphere as shown in the figure below (top left):

If the role of the box and clipping sphere is reversed as follows:

sphere {
     0*x, 1.45
     clipped_by {
          box { < -1, -1, -1 >, < 1, 1, 1 > }
     }
     // pigment and finish
}
we have the top right object. It is obtained by cutting off all part of a sphere that is inside of the box.

Inverse

In many applications, we want to cut off unwanted parts that are outside of a clipping shape. In this case, keyword inverse will be useful. Keyword inverse should be used in a shape rather than in clipped_by {}. The effect of inverse turns the inside (resp., outside) to its outside (resp., inside). For example,
sphere {
     0*x, 1 inverse
}
This reverse the inside/outside definition of a sphere. Thus, point < 2, 0, 0 > and < 0.5, 0, 0 > now lie in the "inside" and "outside" of the sphere, respectively. Thus, using inverse will affect all CSG operations and clipping.

The lower left object above is generated by

box {
     < -1, -1, -1 >, < 1, 1, 1 >
     clipped_by {
          sphere { 0*x, 1.45 inverse }
     }
     // pigment and finish
}
All parts of the box that are in the outside of the unit sphere (or the inside of the "inverted" unit sphere) are preserved. Please compare this with the top left object. In fact, the union of these two objects is the box itself. Why?

The lower right object above is generated with the following:

sphere {
     0*x, 1.45
     clipped_by {
          box { < -1, -1, -1 >, < 1, 1, 1 >  inverse }
     }
     // pigment and finish
}
All parts that are outside of the clipping box (or inside of the "inverted" box) are preserved.