Sphere Sweep Object

### 3.4.4 Sphere Sweep Object

A Sphere Sweep Object is the space a sphere occupies during its movement along a spline.
So we need to specify the kind of spline we want and a list of control points to define that spline. To help POV-Ray we tell how many control points will be used. In addition, we also define the radius the moving sphere should have when passing through each of these control points.

The syntax of the sphere_sweep object is:

      sphere_sweep {
        linear_spline | b_spline | cubic_spline
        NUM_OF_SPHERES,

        CENTER, RADIUS,
        CENTER, RADIUS,
        ...
        CENTER, RADIUS
        [tolerance DEPTH_TOLERANCE]
        [OBJECT_MODIFIERS]
      }

An example for a linear Sphere Sweep would be:

      sphere_sweep {
        linear_spline
        4,
        <-5, -5, 0>, 1
        <-5,  5, 0>, 1
        < 5, -5, 0>, 1
        < 5,  5, 0>, 1
      }

This object is described by four spheres. You can use as many spheres as you like to describe the object, but you will need at least two spheres for a linear Sphere Sweep, and four spheres for one approximated with a cubic_spline or b_spline.

The example above would result in an object shaped like the letter "N". The sphere sweep goes through all points which are connected with straight cones.

Changing the kind of interpolation to a cubic_spline produces a quite different, slightly bent, object. It then starts at the second sphere and ends at the last but one. Since the first and last points are used to control the spline, you need two more points to get a shape that can be compared to the linear sweep. Let's add them:

      sphere_sweep {
        cubic_spline
        6,
        <-4, -5, 0>, 1
        <-5, -5, 0>, 1
        <-5,  5, 0>, 0.5
        < 5, -5, 0>, 0.5
        < 5,  5, 0>, 1
        < 4,  5, 0>, 1
        tolerance 0.1
     }

So the cubic sweep creates a smooth sphere sweep actually going through all points (except the first and last one). In this example the radius of the second and third spheres have been changed. We also added the "tolerance" keyword, because dark spots appeared on the surface with the default value (0.000001).

When using a b_spline, the resulting object is somewhat similar to the cubic sweep, but doesn't actually go through the control points. It lies somewhere between them.