Primitive objects are the building box with which other objects are created. Each primitive type has associated with it specialized methods for creation, intersection with a ray, bounding box calculation, surface normal calculation, ray enter/exit classification, and for the computation 2D texture coordinates termed u-v coordinates. This latter method is often referred to as the inverse mapping method.
While most of these methods should be of little concern to you, the inverse mapping methods will affect the way in which certain textures are applied to primitives. Inverse mapping is a matter of computing normalized u and v coordinates for a given point on the surface of the primitive. For planar objects, the u and v coordinates of a point are computed by linear interpolation based upon the u and v coordinates assigned to vertices or other known points on the primitive. For non-planar objects, uv computation can be considerably more involved.
This section briefly describes each primitive and the syntax that should be used to create an instance of the primitive. It also describes the inverse mapping method, if any, for each type.
The metaballs affect each other according to a superimposed
density distribution:
Transformations may be applied to the box if a non-axis-aligned instance
is required. There is no inverse mapping method for boxes.
Note that ellipsoids may be created by applying the proper scaling
to a sphere. Inverse mapping on the sphere is accomplished
by computing the longitude and latitude of the point on the sphere,
with the u value corresponding to longitude and v to latitude.
On an untransformed sphere, the z axis defines the poles, and the
x axis intersects the sphere at u = 0, v = 0.5. There are
degeneracies at the poles: the south pole contains all points of
latitude 0., the north all points of latitude 1.
In tori inverse mapping,
the u value is computed using the angle of rotation about the
up vector, and the v value is computing the angle of rotation
around the tube, with v = 0 occuring on the innermost point of the tube.
For both Phong- and flat-shaded triangles, the u axis is the
vector from p1 to p2, and the v axis the vector
from p1 to p3. There is a degeneracy at
p3, which contains all points with v = 1.0. This default
mapping may be modified using the triangleuv primitive described
below.
When computing uv coordinates within the interior of the
triangle, linear interpolation of the coordinates associated with
each triangle vertex is used.
Inverse mapping for arbitrary polygons is problematical.
punts and equates u with the x coordinate of the point of intersection,
and v with the y coordinate.
See Appendix C for a discussion of the format of a height field file.
Height field inverse mapping is straight-forward: u is the
x coordinate of the point of intersection, v the y coordinate.
Inverse mapping on the plane is identical to polygonal inverse mapping.
The cylinder's axis defines the v axis. The u axis wraps around the
cylinder, with u = 0 dependent upon the orientation of the cylinder.
Cone inverse mapping is analogous to cylinder mapping.
Discs are useful for placing
endcaps on cylinders and cones.
Inverse mapping for the disc is based on the computation of the
normalized polar coordinates of the point of intersection. The
normalized radius
of the point of intersection is assigned to u, while the normalized angle
from a reference vector is assigned to v.