<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2 Final//en">

<!–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 $\overrightarrow{\em {p}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img9.png" ALT=" $\overrightarrow{\em {p}}$"> [<EM>st r</EM> <!– MATH $\overrightarrow{\em {p}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img9.png" ALT=" $\overrightarrow{\em {p}}$"> ...] <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 $\overrightarrow{\em {p}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img9.png" ALT=" $\overrightarrow{\em {p}}$">, radius <EM>r</EM>, and strength <EM>st</EM>. </DD> </DL>The metaballs affect each other according to a superimposed density distribution: <P><!– MATH

F(x, y, z) = $\displaystyle \sum_{{i=0}}^{n}$bie-di - T = 0

–> </P> <DIV ALIGN="CENTER"> <I>F</I>(<I>x</I>, <I>y</I>, <I>z</I>) = <IMG STYLE="height: 2.43ex; vertical-align: 158.83ex; " SRC="img10.png" ALT=" $\displaystyle \sum_{{{i=0}}}^{{n}}$"><I>b</I><SUB>i</SUB><I>e</I><SUP>-d<SUB>i</SUB></SUP> - <I>T</I> = 0 </DIV><P></P> There is no inverse mapping method for blobs.

<P> <DL> <DT></DT> <DD><TT>box</TT> <!– MATH $\overrightarrow{\em {corner1}}$ –> <IMG STYLE="height: 6.13ex; vertical-align: 157.42ex; " SRC="img11.png" ALT=" $\overrightarrow{\em {corner1}}$"> <!– MATH $\overrightarrow{\em {corner2}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img12.png" ALT=" $\overrightarrow{\em {corner2}}$"> <BR> Creates an axis-aligned box which has <!– MATH $\overrightarrow{\em {corner1}}$ –> <IMG STYLE="height: 6.13ex; vertical-align: 157.42ex; " SRC="img11.png" ALT=" $\overrightarrow{\em {corner1}}$"> and <!– MATH $\overrightarrow{\em {corner2}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img12.png" ALT=" $\overrightarrow{\em {corner2}}$"> 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 $\overrightarrow{\em {center}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img13.png" ALT=" $\overrightarrow{\em {center}}$"> <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 $\overrightarrow{\em {center}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img13.png" ALT=" $\overrightarrow{\em {center}}$"> <!– MATH $\overrightarrow{\em {up}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img14.png" ALT=" $\overrightarrow{\em {up}}$"> <BR> Creates a torus centered at <!– MATH $\overrightarrow{\em {center}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img13.png" ALT=" $\overrightarrow{\em {center}}$"> 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 $\overrightarrow{\em {p1}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png" ALT=" $\overrightarrow{\em {p1}}$"> <!– MATH $\overrightarrow{\em {p2}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png" ALT=" $\overrightarrow{\em {p2}}$"> <!– MATH $\overrightarrow{\em {p3}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png" ALT=" $\overrightarrow{\em {p3}}$"> <BR> Creates a triangle with the given vertices. </DD> </DL> <P> <DL> <DT></DT> <DD><TT>triangle</TT> <!– MATH $\overrightarrow{\em {p1}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png" ALT=" $\overrightarrow{\em {p1}}$"> <!– MATH $\overrightarrow{\em {n1}}$ –> <IMG STYLE="height: 2.43ex; vertical-align: 161.64ex; " SRC="img15.png" ALT=" $\overrightarrow{\em {n1}}$"> <!– MATH $\overrightarrow{\em {p2}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png" ALT=" $\overrightarrow{\em {p2}}$"> <!– MATH $\overrightarrow{\em {n2}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img16.png" ALT=" $\overrightarrow{\em {n2}}$"> <!– MATH $\overrightarrow{\em {p3}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png" ALT=" $\overrightarrow{\em {p3}}$"> <!– MATH $\overrightarrow{\em {n3}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img17.png" ALT=" $\overrightarrow{\em {n3}}$"> <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 $\overrightarrow{\em {p1}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png" ALT=" $\overrightarrow{\em {p1}}$"> to <!– MATH $\overrightarrow{\em {p2}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png" ALT=" $\overrightarrow{\em {p2}}$">, and the <I>v</I> axis the vector from <!– MATH $\overrightarrow{\em {p1}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png" ALT=" $\overrightarrow{\em {p1}}$"> to <!– MATH $\overrightarrow{\em {p3}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png" ALT=" $\overrightarrow{\em {p3}}$">. There is a degeneracy at <!– MATH $\overrightarrow{\em {p3}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png" ALT=" $\overrightarrow{\em {p3}}$">, 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 $\overrightarrow{\em {p1}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png" ALT=" $\overrightarrow{\em {p1}}$"> <!– MATH $\overrightarrow{\em {n1}}$ –> <IMG STYLE="height: 2.43ex; vertical-align: 161.64ex; " SRC="img15.png" ALT=" $\overrightarrow{\em {n1}}$"> <!– MATH $\overrightarrow{\em {uv1}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img18.png" ALT=" $\overrightarrow{\em {uv1}}$"> <!– MATH $\overrightarrow{\em {p2}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png" ALT=" $\overrightarrow{\em {p2}}$"> <!– MATH $\overrightarrow{\em {n2}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img16.png" ALT=" $\overrightarrow{\em {n2}}$"> <!– MATH $\overrightarrow{\em {uv2}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img19.png" ALT=" $\overrightarrow{\em {uv2}}$"> <!– MATH $\overrightarrow{\em {p3}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png" ALT=" $\overrightarrow{\em {p3}}$"> <!– MATH $\overrightarrow{\em {n3}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img17.png" ALT=" $\overrightarrow{\em {n3}}$"> <!– MATH $\overrightarrow{\em {uv3}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.51ex; " SRC="img20.png" ALT=" $\overrightarrow{\em {uv3}}$"> <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 $\overrightarrow{\em {p1}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img6.png" ALT=" $\overrightarrow{\em {p1}}$"> <!– MATH $\overrightarrow{\em {p2}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img7.png" ALT=" $\overrightarrow{\em {p2}}$"> <!– MATH $\overrightarrow{\em {p3}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img8.png" ALT=" $\overrightarrow{\em {p3}}$"> [<!– MATH $\overrightarrow{\em {p4}}$ –> <IMG STYLE="height: 2.55ex; vertical-align: 161.06ex; " SRC="img21.png" ALT=" $\overrightarrow{\em {p4}}$"> ...] <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 $\overrightarrow{\em {point}}$ –> <IMG STYLE="height: 2.94ex; vertical-align: 160.67ex; " SRC="img22.png" ALT=" $\overrightarrow{\em {point}}$"> <!– MATH $\overrightarrow{\em {normal}}$ –> <IMG STYLE="height: 3.00ex; vertical-align: 161.06ex; " SRC="img23.png" ALT=" $\overrightarrow{\em {normal}}$"> <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 $\overrightarrow{\em {bottom}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png" ALT=" $\overrightarrow{\em {bottom}}$"> <!– MATH $\overrightarrow{\em {top}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png" ALT=" $\overrightarrow{\em {top}}$"> <BR> Creates a cylinder that extends from <!– MATH $\overrightarrow{\em {bottom}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png" ALT=" $\overrightarrow{\em {bottom}}$"> to <!– MATH $\overrightarrow{\em {top}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png" ALT=" $\overrightarrow{\em {top}}$"> 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 $\overrightarrow{\em {bottom}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png" ALT=" $\overrightarrow{\em {bottom}}$"> <I>rad</I><SUB>top</SUB> <!– MATH $\overrightarrow{\em {top}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png" ALT=" $\overrightarrow{\em {top}}$"> <BR> Creats a (truncated) cone that extends from <!– MATH $\overrightarrow{\em {bottom}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png" ALT=" $\overrightarrow{\em {bottom}}$"> to <!– MATH $\overrightarrow{\em {top}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png" ALT=" $\overrightarrow{\em {top}}$">. The cone will have a radius of <!– MATH radbottom –> <I>rad</I><SUB>bottom</SUB> at <!– MATH $\overrightarrow{\em {bottom}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 161.38ex; " SRC="img24.png" ALT=" $\overrightarrow{\em {bottom}}$"> and a radius of <I>rad</I><SUB>top</SUB> at <!– MATH $\overrightarrow{\em {top}}$ –> <IMG STYLE="height: 2.68ex; vertical-align: 160.93ex; " SRC="img25.png" ALT=" $\overrightarrow{\em {top}}$">. 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 $\overrightarrow{\em {pos}}$ –> <IMG STYLE="height: 2.49ex; vertical-align: 161.12ex; " SRC="img3.png" ALT=" $\overrightarrow{\em {pos}}$"> <!– MATH $\overrightarrow{\em {normal}}$ –> <IMG STYLE="height: 3.00ex; vertical-align: 161.06ex; " SRC="img23.png" ALT=" $\overrightarrow{\em {normal}}$"> <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>