Game Development Reference
In-Depth Information
the outline of the shape we are describing—in this example, a unit circle
centered at the origin (see Figure 9.1) .
It is often convenient to normalize the parameter to be in the range
[0,1], although we may allow t to assume any range of values we wish.
Another common choice is [0,l], where l is some measure of the length of
the primitive.
When our functions are in terms of one parameter, we say that the func-
tions are univariate. Univariate functions trace out a 1D shape: a curve.
(Chapter 13 presents more about parametric curves.) It's also possible to
use more than one parameter. A bivariate function accepts two parameters,
usually assigned to the variables s and t. Bivariate functions trace out a
surface rather than a line.
We have dubbed the final method for representing primitives, for lack
of a better term, straightforward forms. By this we mean all the ad-hoc
methods that capture the most important and obvious information directly.
For example, to describe a line segment, we could name the two endpoints.
A sphere is described most simply by giving its center and radius. The
straightforward forms are the easiest for humans to work with directly.
Regardless of the method of representation, each geometric primitive has
an inherent number of degrees of freedom. This is the minimum number
of “pieces of information” that are required to describe the entity unam-
biguously. It is interesting to notice that for the same geometric primitive,
some representation forms use more numbers than others. However, we
find that any “extra” numbers are always due to a redundancy in the pa-
rameterization of the primitive, which could be eliminated by assuming the
appropriate constraint, such as a vector having unit length. For example, a
circle in the plane has three degrees of freedom: two for the position of the
center (x c ,y c ) and one for the radius r. In parametric form these variables
appear directly:
Parametric circle with
arbitrary center and
radius
x(t) = x c + r cos 2πt,
y(t) = y c + r sin 2πt.
However, the general conic section equation (the implicit form) is Ax 2 +
Bxy + Cy 2 + D = 0, which has four coe cients. A general conic section
can be recognized as a circle if it can be manipulated into the form
Implicit circle with
arbitrary center and
radius
(x − x c ) 2 + (y − y c ) 2 = r 2 .
9.2
Lines and Rays
Now for some specific types of primitives. We begin with what is perhaps
the most basic and important one of all: the linear segment. Let's meet
 
Search WWH ::




Custom Search