POVRAY supports several simple objects: spheres, boxes, planes, cylinders, cones and tori:
sphere { < a, b, c >, r } plane { < a, b, c >, d } box { < p, q, r >, < u, v, w > } cylinder { < p, q, r >, < u, v, w >, R [open] } cone { < p, q, r >, R1, < u, v, w >, R2 [open] } torus { R1, R2 }
Thus, a sphere with center < 0, 0, 0 > and radius 1 is written assphere { < a, b, c >, r }
orsphere { < 0, 0, 0 >, 1 }
sphere { 0*x, 1 }
Note that a normal vector always points outward. That is, normal vectors always point to the exterior of the surface. The distance d is measured from the origin to the plane. If the direction from the origin to this plane is identical to that of the normal vector, the distance is positive; otherwise, it is negative.plane { < a, b, c >, d }
For example, suppose we have a plane like
Its normal vector is < 1, 1, 1 > and the distance from the origin to this plane is 1.414 (the square root of 2). Since the distance is positive, it is considered in the same direction as the normal vector. As a result, the plane is the one containing the green triangle (the plane is clipped to show the other one). If the plane is changed toplane { x+y+z, 1.141 }
Since the distance is negative and is in the opposite direction of the normal, the resulting plane is the one containing the other triangle.plane { x+y+z, -1.141 }
If a box is defined asbox { < p, q, r >, < u, v, w > }
in the x-, y- and z-axis direction, the widths of the box are 2, 2 and 1. Here is the result:box { < -1, -1, -0.5 >, // lower-left corner < 1, 1, 0.5 > // upper-right corner }
The following figure shows two cylinders. The left one does not have keyword open specified and hence two caps are added, one on the top and the other on the bottom. The figure also shows the axis of the cylinder. The red spheres are the given points. Both the axes and points are shown for illustration purpose and should not appear in the image.cylinder { < p, q, r >, < u, v, w >, R [open] }
Below are two cones, the left is a closed one. Again, the axes and points (i.e., red dots) are shown to you for illustration purpose. Both should not appear in your image.cone { < p, q, r >, R1, < u, v, w >, R2 [open] }
In POVRAY, the line is the y-axis. The major circle has its center at the origin and radius R1. The plane that contains the minor circle passes through the y-axis. The minor circle has its center on the major circle and its radius R2. Thus, POVRAY puts a torus in a very special position so that a torus can be defined only with a major radius and a minor radius as follow:
The following figure is generated with major radius 1 and minor radius 0.5.torus { R1, R2 }
The left figure shows the major and minor circles, and the coordinate axes, while the right one shows the generated torus. Note that the coordinate axes are not parts of the torus.torus { 1, 0.5 }