Game Development Reference
In-Depth Information
The matrix
C
must be as “tall” as the number of dimensions the data
have; for example, three if we have 3D data. However, we don't need to
refer to specific x, y, or z coordinates much in this chapter because most
of the ideas work the same in 3D or 2D (or 1D!). We can just leave each
coe
cient
c
i
in vector form and assume that it is a vector of the appropriate
dimension, so that each
c
i
corresponds to a single column of
C
:
2
4
1
3
5
2
4
| | | |
3
2
4
| | | |
3
Coe
cients as column
vectors
t
t
2
t
3
5
5
C
=
c
0
c
1
c
2
c
3
|
,
p
(t) =
Ct
=
c
0
c
1
c
2
c
3
|
.
|
|
|
|
|
|
When dealing with a higher degree polynomial, the matrix
C
is wider
and the power vector
t
is taller, since we have more coe
cients and more
powers of t. This not only makes sense, it's the law: for the product
Ct
to be legal according to linear algebra rules, the number of columns in
C
must match the number of rows in
t
.
13.1.4 Two Trivial Types of Curves
Although you're reading this section because you want to learn how to draw
a curve, allow a brief digression to mention two trivial types of “curves”: a
straight line segment and a point.
We showed how to represent a line segment parametrically in Section 9.2
when we discussed rays. Consider a ray from the point
p
0
to the point
p
1
. If
we let
d
be the delta vector
p
1
−
p
0
, then the ray is expressed parametrically
as
p
(t) =
p
0
+
d
t.
(13.3)
Parametric line segment
Observe that this is a polynomial of the type we've been considering, where
c
0
=
p
0
,
c
1
=
d
, and the other coe
cients are zero. In other words, this
linear curve is a polynomial curve of degree 1.
As boring as lines are, there's an even less interesting shape that can be
represented in parametric polynomial form: the point. Lowering the degree
of the polynomial from 1 to 0 results in a so-called constant curve. In this
case, the function
p
(t) =
c
0
always returns the same value, resulting in a
“curve” that is a single stationary point.
13.1.5 Endpoints in Monomial Form
Clearly, one of the most basic properties of a curve that we want to control
are the locations of its start and end,
p
(0) and
p
(1), respectively. Let's
Search WWH ::
Custom Search