<!–Converted with LaTeX2HTML 2022 (Released January 1, 2022) –> <HTML lang="en"> <HEAD> <TITLE>Contents of Primitives</TITLE>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=utf-8"> <META NAME="viewport" CONTENT="width=device-width, initial-scale=1.0"> <META NAME="Generator" CONTENT="LaTeX2HTML v2022">
<LINK REL="STYLESHEET" HREF="guide.css">
<LINK REL="next" HREF="node23_mn.html"> <LINK REL="previous" HREF="node21_mn.html"> <LINK REL="up" HREF="node20_mn.html"> <LINK REL="next" HREF="node23_mn.html"> </HEAD>
<BODY bgcolor="#ffffff" text="#000000" link="#9944EE" vlink="#0000ff" alink="#00ff00">
<H1><A ID="SECTION00720000000000000000"> Primitives</A> </H1>
<P> 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 <EM>u-v</EM> coordinates. This latter method is often referred to as the <EM>inverse mapping</EM> method.
<P> 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 <I>u</I> and <I>v</I> coordinates for a given point on the surface of the primitive. For planar objects, the <I>u</I> and <I>v</I> coordinates of a point are computed by linear interpolation based upon the <I>u</I> and <I>v</I> coordinates assigned to vertices or other known points on the primitive. For non-planar objects, <I>uv</I> computation can be considerably more involved.
<P> 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.
<P>
<DL>
<DT></DT>
<DD><TT>blob</TT> <EM>thresh st r</EM> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img9.png"
ALT="
"> [<EM>st r</EM> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img9.png"
ALT="
"> ...]
<BR>
Defines a blob with consisting of a threshold equal to <EM>thresh</EM>,
and a
group of one or more metaballs. Each metaball is defined by
its position <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img9.png"
ALT="
">, radius <EM>r</EM>, and strength <EM>st</EM>.
</DD>
</DL>The metaballs affect each other according to a superimposed
density distribution:
<P><!– MATH
<P>
<DL>
<DT></DT>
<DD><TT>box</TT> <!– MATH
–>
<IMG
STYLE="height: 6.13ex; vertical-align: 157.42ex; " SRC="img11.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img12.png"
ALT="
">
<BR>
Creates an axis-aligned box
which has <!– MATH
–>
<IMG
STYLE="height: 6.13ex; vertical-align: 157.42ex; " SRC="img11.png"
ALT="
"> and <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img12.png"
ALT="
"> as
opposite corners.
</DD>
</DL>Transformations may be applied to the box if a non-axis-aligned instance
is required. There is no inverse mapping method for boxes.
<P>
<DL>
<DT></DT>
<DD><TT>sphere</TT> <EM>radius</EM> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img13.png"
ALT="
">
<BR>
Creates a sphere with the given <EM>radius</EM> and centered at the
given position.
</DD>
</DL>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 <I>u</I> value corresponding to longitude and <I>v</I> to latitude.
On an untransformed sphere, the <I>z</I> axis defines the poles, and the
<I>x</I> axis intersects the sphere at <I>u</I> = 0, <I>v</I> = 0.5. There are
degeneracies at the poles: the south pole contains all points of
latitude 0., the north all points of latitude 1.
<P>
<DL>
<DT></DT>
<DD><TT>torus</TT> <EM>rmajor rminor</EM> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img13.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img14.png"
ALT="
">
<BR>
Creates a torus centered at <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img13.png"
ALT="
"> by rotating
a circle with the given minor radius around the center
point at a distance equal to the major radius.
</DD>
</DL>In tori inverse mapping,
the <I>u</I> value is computed using the angle of rotation about the
up vector, and the <I>v</I> value is computing the angle of rotation
around the tube, with <I>v</I> = 0 occuring on the innermost point of the tube.
<P>
<DL>
<DT></DT>
<DD><TT>triangle</TT> <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png"
ALT="
">
<BR>
Creates a triangle with the given vertices.
</DD>
</DL>
<P>
<DL>
<DT></DT>
<DD><TT>triangle</TT> <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.43ex; vertical-align: 161.64ex; " SRC="img15.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img16.png"
ALT="
">
<!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img17.png"
ALT="
">
<BR>
Creates a Phong-shaded triangle with the given vertices and
vertex normals.
</DD>
</DL>For both Phong- and flat-shaded triangles, the <I>u</I> axis is the
vector from <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png"
ALT="
"> to <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png"
ALT="
">, and the <I>v</I> axis the vector
from <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png"
ALT="
"> to <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png"
ALT="
">. There is a degeneracy at
<!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png"
ALT="
">, which contains all points with <I>v</I> = 1.0. This default
mapping may be modified using the <TT>triangleuv</TT> primitive described
below.
<P>
<DL>
<DT></DT>
<DD><TT>triangleuv</TT> <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.43ex; vertical-align: 161.64ex; " SRC="img15.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img18.png"
ALT="
">
<!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img16.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img19.png"
ALT="
">
<!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img17.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img20.png"
ALT="
">
<BR>
Creates a Phong-shaded triangle with the given vertices,
vertex normals. When performing texturing, the
<EM>uv</EM> given for each vertex are used instead of the
default values.
</DD>
</DL>When computing <I>uv</I> coordinates within the interior of the
triangle, linear interpolation of the coordinates associated with
each triangle vertex is used.
<P>
<DL>
<DT></DT>
<DD><TT>poly</TT> <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png"
ALT="
"> [<!– MATH
–>
<IMG
STYLE="height: 2.55ex; vertical-align: 161.06ex; " SRC="img21.png"
ALT="
"> ...]
<BR>
Creates a polygon with the given vertices. The vertices
should be given in counter-clockwise order as one is
looking at the ``front'' side of the polygon. The number of
vertices in a polygon is limited only by available memory.
</DD>
</DL>Inverse mapping for arbitrary polygons is problematical.
<EM>Rayshade</EM>
punts and equates <I>u</I> with the <I>x</I> coordinate of the point of intersection,
and <I>v</I> with the <I>y</I> coordinate.
<P> <DL> <DT></DT> <DD><TT>heightfield</TT> <EM>file</EM> <BR> Creates a height field defined by the altitude data stored in the named <EM>file</EM>. The height field is based upon perturbations of the unit square in the <I>z</I> = 0 plane, and is rendered as a surface tessellated by right isosceles triangles. </DD> </DL>See Appendix C for a discussion of the format of a height field file. Height field inverse mapping is straight-forward: <I>u</I> is the <I>x</I> coordinate of the point of intersection, <I>v</I> the <I>y</I> coordinate.
<P>
<DL>
<DT></DT>
<DD><TT>plane</TT> <!– MATH
–>
<IMG
STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img22.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 3.00ex; vertical-align: 161.06ex; " SRC="img23.png"
ALT="
">
<BR>
Creates a plane that passes through the given point and
has the specified normal.
</DD>
</DL>Inverse mapping on the plane is identical to polygonal inverse mapping.
<P>
<DL>
<DT></DT>
<DD><TT>cylinder</TT> <EM>radius</EM> <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png"
ALT="
">
<BR>
Creates a cylinder that extends from <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png"
ALT="
"> to <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png"
ALT="
">
and has the indicated <EM>radius</EM>. Cylinders are rendered
<EM>without</EM> endcaps.
</DD>
</DL>The cylinder's axis defines the <I>v</I> axis. The <I>u</I> axis wraps around the
cylinder, with <I>u</I> = 0 dependent upon the orientation of the cylinder.
<P>
<DL>
<DT></DT>
<DD><TT>cone</TT> <!– MATH
radbottom
–>
<I>rad</I><SUB>bottom</SUB> <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png"
ALT="
"> <I>rad</I><SUB>top</SUB> <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png"
ALT="
">
<BR>
Creats a (truncated) cone that extends from <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png"
ALT="
"> to
<!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png"
ALT="
">. The cone will have a radius of <!– MATH
radbottom
–>
<I>rad</I><SUB>bottom</SUB> at
<!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png"
ALT="
"> and a radius of <I>rad</I><SUB>top</SUB> at <!– MATH
–>
<IMG
STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png"
ALT="
">.
Cones are rendered <EM>without</EM> endcaps.
</DD>
</DL>Cone inverse mapping is analogous to cylinder mapping.
<P>
<DL>
<DT></DT>
<DD><TT>disc</TT> <EM>radius</EM> <!– MATH
–>
<IMG
STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img3.png"
ALT="
"> <!– MATH
–>
<IMG
STYLE="height: 3.00ex; vertical-align: 161.06ex; " SRC="img23.png"
ALT="
">
<BR>
Creates a disc centered at the given position and with the
indicated surface normal.
</DD>
</DL>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 <I>u</I>, while the normalized angle
from a reference vector is assigned to <I>v</I>.
<P>
<HR>
</BODY> </HTML>