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 <#358#>u-v<#358#>
coordinates.
This latter method is often referred to as the <#359#>inverse mapping<#359#>
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.
- <#4723#><#4723#>
- <#1277#>blob<#1277#> <#1278#>thresh st r<#1278#> #math74##tex2html_wrap_inline4725# [<#1280#>st r<#1280#> #math75##tex2html_wrap_inline4727# ...]
Defines a blob with consisting of a threshold equal to <#366#>thresh<#366#>,
and a
group of one or more metaballs. Each metaball is defined by
its position #math76##tex2html_wrap_inline4729#, radius <#368#>r<#368#>, and strength <#369#>st<#369#>.
The metaballs affect each other according to a superimposed
density distribution:
#math77#
F(x, y, z) = #tex2html_wrap_indisplay4731#bie-di - T = 0
There is no inverse mapping method for blobs.
- <#4732#><#4732#>
- <#1284#>box<#1284#> #math78##tex2html_wrap_inline4734# #math79##tex2html_wrap_inline4736#
Creates an axis-aligned box
which has #math80##tex2html_wrap_inline4738# and #math81##tex2html_wrap_inline4740# as
opposite corners.
Transformations may be applied to the box if a non-axis-aligned instance
is required. There is no inverse mapping method for boxes.
- <#4741#><#4741#>
- <#1289#>sphere<#1289#> <#1290#>radius<#1290#> #math82##tex2html_wrap_inline4743#
Creates a sphere with the given <#385#>radius<#385#> and centered at the
given position.
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.
- <#4750#><#4750#>
- <#1294#>torus<#1294#> <#1295#>rmajor rminor<#1295#> #math83##tex2html_wrap_inline4752# #math84##tex2html_wrap_inline4754#
Creates a torus centered at #math85##tex2html_wrap_inline4756# by rotating
a circle with the given minor radius around the center
point at a distance equal to the major radius.
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.
- <#4760#><#4760#>
- <#1300#>triangle<#1300#> #math86##tex2html_wrap_inline4762# #math87##tex2html_wrap_inline4764# #math88##tex2html_wrap_inline4766#
Creates a triangle with the given vertices.
- <#4767#><#4767#>
- <#1306#>triangle<#1306#> #math89##tex2html_wrap_inline4769# #math90##tex2html_wrap_inline4771# #math91##tex2html_wrap_inline4773# #math92##tex2html_wrap_inline4775#
#math93##tex2html_wrap_inline4777# #math94##tex2html_wrap_inline4779#
Creates a Phong-shaded triangle with the given vertices and
vertex normals.
For both Phong- and flat-shaded triangles, the u axis is the
vector from #math95##tex2html_wrap_inline4782# to #math96##tex2html_wrap_inline4784#, and the v axis the vector
from #math97##tex2html_wrap_inline4787# to #math98##tex2html_wrap_inline4789#. There is a degeneracy at
#math99##tex2html_wrap_inline4791#, which contains all points with v = 1.0. This default
mapping may be modified using the <#414#>triangleuv<#414#> primitive described
below.
- <#4793#><#4793#>
- <#1315#>triangleuv<#1315#> #math100##tex2html_wrap_inline4795# #math101##tex2html_wrap_inline4797# #math102##tex2html_wrap_inline4799#
#math103##tex2html_wrap_inline4801# #math104##tex2html_wrap_inline4803# #math105##tex2html_wrap_inline4805#
#math106##tex2html_wrap_inline4807# #math107##tex2html_wrap_inline4809# #math108##tex2html_wrap_inline4811#
Creates a Phong-shaded triangle with the given vertices,
vertex normals. When performing texturing, the
<#426#>uv<#426#> given for each vertex are used instead of the
default values.
When computing uv coordinates within the interior of the
triangle, linear interpolation of the coordinates associated with
each triangle vertex is used.
- <#4813#><#4813#>
- <#1327#>poly<#1327#> #math109##tex2html_wrap_inline4815# #math110##tex2html_wrap_inline4817# #math111##tex2html_wrap_inline4819# [#math112##tex2html_wrap_inline4821# ...]
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.
Inverse mapping for arbitrary polygons is problematical.
<#435#><#1927#>Rayshade<#1927#><#435#>
punts and equates u with the x coordinate of the point of intersection,
and v with the y coordinate.
- <#4826#><#4826#>
- <#1334#>heightfield<#1334#> <#1335#>file<#1335#>
Creates a height field defined by the altitude data stored
in the named <#439#>file<#439#>. The height field is based upon
perturbations of the unit square in the z = 0 plane, and is
rendered as a surface tessellated by right isosceles triangles.
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.
- <#4832#><#4832#>
- <#1338#>plane<#1338#> #math113##tex2html_wrap_inline4834# #math114##tex2html_wrap_inline4836#
Creates a plane that passes through the given point and
has the specified normal.
Inverse mapping on the plane is identical to polygonal inverse mapping.
- <#4837#><#4837#>
- <#1343#>cylinder<#1343#> <#1344#>radius<#1344#> #math115##tex2html_wrap_inline4839# #math116##tex2html_wrap_inline4841#
Creates a cylinder that extends from #math117##tex2html_wrap_inline4843# to #math118##tex2html_wrap_inline4845#
and has the indicated <#453#>radius<#453#>. Cylinders are rendered
<#454#>without<#454#> endcaps.
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.
- <#4849#><#4849#>
- <#1349#>cone<#1349#> #math119#radbottom #math120##tex2html_wrap_inline4852# radtop #math121##tex2html_wrap_inline4855#
Creats a (truncated) cone that extends from #math122##tex2html_wrap_inline4857# to
#math123##tex2html_wrap_inline4859#. The cone will have a radius of #math124#radbottom at
#math125##tex2html_wrap_inline4862# and a radius of radtop at #math126##tex2html_wrap_inline4865#.
Cones are rendered <#468#>without<#468#> endcaps.
Cone inverse mapping is analogous to cylinder mapping.
- <#4866#><#4866#>
- <#1356#>disc<#1356#> <#1357#>radius<#1357#> #math127##tex2html_wrap_inline4868# #math128##tex2html_wrap_inline4870#
Creates a disc centered at the given position and with the
indicated surface normal.
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.