### Section 7.5.2.7Lathe

The lathe is an object generated from rotating a two-dimensional curve about an axis. This curve is defined by a set of points which are connected by linear, quadratic or cubic spline curves. The syntax is:

lathe { [ linear_spline | quadratic_spline | cubic_spline ] NUMBER_OF_POINTS, <POINT_1>, <POINT_2>, ..., <POINT_n> [ sturm ] }

The following examples creates a simple lathe object that looks like a thick cylinder, i. e. a cylinder with a thick wall:

lathe { linear_spline 5, <2, 0>, <3, 0>, <3, 5>, <2, 5>, <2, 0> pigment {Red} }

You should note that the number of spline segments, i. e. curves between two points, depends on the spline type used. For linear splines you get n-1 segments connecting the points P[i], i=1,...,n. A quadratic spline gives you n-2 segments because the last point is only used for determining the slope as explained above (thus you'll need at least three points to define a quadratic spline). The same holds for cubic splines where you get n-3 segments with the first and last point used only for slope calculations (thus needing at least four points).

If you want to get a closed quadratic and cubic spline with smooth transitions at the end points you have to make sure that in the cubic case P[n-1] = P (to get a closed curve), P[n] = P and P[n-2] = P (to smooth the transition). In the quadratic case P[n-1] = P (to close the curve) and P[n] = P.

### Section 7.5.2.8Prism

The prism is an object generated from sweeping one or more two-dimensional, closed curves along an axis. These curves are defined by a set of points which are connected by linear, quadratic or cubic splines.

The syntax for the prism is:

prism { [ linear_sweep | conic_sweep ] [ linear_spline | quadratic_spline | cubic_spline ] HEIGHT1, HEIGHT2, TOTAL_NUMBER_OF_POINTS, <POINT_1>, <POINT_2>, ..., <POINT_n> [ open ] [ sturm ] }

The prism object allows you to use any number of sub-prisms inside one prism statement (they are of the same spline and sweep type). Wherever an even number of sub-prisms overlaps a hole appears.

prism { linear_spline HEIGHT1, HEIGHT2, TOTAL_NUMBER_OF_POINTS, <A_1>, <A_2>, ..., <A_na>, <A_1>, <B_1>, <B_2>, ..., <B_nb>, <B_1>, <C_1>, <C_2>, ..., <C_nc>, <C_1>, ... }

Each of the sub-prisms has to be closed by repeating the first point of a sub-prism at the end of the sub-prism's point sequence. If this is not the case a warning is issued and the prism is ignored (with linear splines automatic closing is used). This implies that all points of a prism are different (except the first and last of course). This applies to all spline types though the control points of the quadratic and cubic splines can be arbitrarily chosen.

The last sub-prism of a linear spline prism is automatically closed - just like the last sub-polygon in the polygon statement - if the first and last point of the sub-polygon's point sequence are not the same. This make it very easy to convert between polygons and prisms. Quadratic and cubic splines are never automatically closed.

prism { quadratic_spline HEIGHT1, HEIGHT2, TOTAL_NUMBER_OF_POINTS, <CL_A>, <A_1>, <A_2>, ..., <A_na>, <A_1>, <CL_B>, <B_1>, <B_2>, ..., <B_nb>, <B_1>, <CL_C>, <C_1>, <C_2>, ..., <C_nc>, <C_1>, ... }

Quadratic spline sub-prisms need an additional control point at the beginning of each sub-prisms' point sequence to determine the slope at the start of the curve.

prism { cubic_spline HEIGHT1, HEIGHT2, TOTAL_NUMBER_OF_POINTS, <CL_A1>, <A_1>, <A_2>, ..., <A_na>, <A_1>, <CL_A2>, <CL_B1>, <B_1>, <B_2>, ..., <B_nb>, <B_1>, <CL_B2>, <CL_C1>, <C_1>, <C_2>, ..., <C_nc>, <C_1>, <CL_C2>, ... }

In addition to the closed point sequence each cubic spline sub-prism needs two control points to determine the slopes at the start and end of the curve.

The following example creates a simple prism object that looks like a piece of cake:

prism { linear_sweep linear_spline 0, 1, 4, <-1, 0>, <1, 0>, <0, 5>, <-1, 0> pigment {Red} }

For an explanation of the spline concept read the description of the lathe object.

Next Section