# Sphere SweepReference

The syntax of the `sphere_sweep`

object is:

SPHERE_SWEEP: sphere_sweep { linear_spline | b_spline | cubic_spline NUM_OF_SPHERES, CENTER, RADIUS, CENTER, RADIUS, ... CENTER, RADIUS [tolerance DEPTH_TOLERANCE] [OBJECT_MODIFIERS] }

Sphere_sweep default values:

tolerance : 1.0e-6 (0.000001)

A Sphere Sweep is the envelope of a moving sphere with varying radius, or, in other words, the
space a sphere occupies during its movement along a spline.

Sphere Sweeps are modeled by specifying a list of single spheres which are then interpolated.

Three kinds of interpolation are supported:

`linear_spline`

: Interpolating the input data with a linear function, which means that the single spheres are connected by straight tubes.`b_spline`

: Approximating the input data using a cubic b-spline function, which results in a curved object.`cubic_spline`

: Approximating the input data using a cubic spline, which results in a curved object.

The sphere list (center and radius of each sphere) can take as many spheres as you like to describe
the object, but you will need at least two spheres for a `linear_spline`

, and four spheres
for `b_spline`

or `cubic_spline`

.

Optional: The depth tolerance that should be used for the intersection calculations. This is done by
adding the `tolerance`

keyword and the desired value: the default distance is
1.0e-6 (0.000001) and should do for most sphere sweep objects.

You should change this when you see dark spots on the surface of the object. These are probably
caused by an effect called *self-shading*. This means that the object casts shadows onto itself at some
points because of calculation errors. A ray tracing program usually defines the minimal distance a ray
must travel before it actually hits another (or the same) object to avoid this effect. If this distance is
chosen too small, self-shading may occur.

If so, specify `tolerance 1.0e-4`

or higher.

**Note:** If these dark spots remain after raising the tolerance, you might get rid of these spots by
using adaptive super-sampling (method 2) for anti-aliasing. Images look better with anti-aliasing anyway.

**Note:** The merge CSG operation is not recommended with Sphere Sweeps: there could be a small gap
between the merged objects!