Game Development Reference
In-Depth Information
the following system of equations:
p
(0) =
p
0
=⇒
c
0
=
p
0
,
(13.9)
v
(0) =
v
0
=⇒
c
1
=
v
0
,
(13.10)
System of equations for
Hermite conditions
v
(1) =
v
1
=⇒
c
1
+ 2
c
2
+ 3
c
3
=
v
1
,
(13.11)
p
(1) =
p
1
=⇒
c
0
+
c
1
+
c
2
+
c
3
=
p
1
.
(13.12)
Equations (13.9) and (13.12), which specify the endpoints, just repeat what
we said in
Section 13.1.5.
Equations (13.10) and (13.11), which specify
velocities, follow directly from the velocity equations for a cubic polynomial
(Equation (13.5) on page 652). The order in which these equations are listed
is a convention used in other literature on curves, and the utility of this
convention will become apparent later in this chapter.
Solving this system of equations results in a method to compute the
monomial coe
cients from the Hermite positions and derivatives:
c
0
=
p
0
,
(13.13)
Converting Hermite
form to monomial form
c
1
=
v
0
,
(13.14)
c
2
= −3
p
0
− 2
v
0
−
v
1
+ 3
p
1
,
(13.15)
c
3
= 2
p
0
+
v
0
+
v
1
− 2
p
1
.
(13.16)
We can also write these equations in the compact matrix notation in-
columns in a matrix
C
, and the powers of t into the column vector
t
, we
can express a polynomial curve as the matrix product
Ct
,
2
4
1
3
2
4
| | | |
3
We can write monomial
form using matrix
notation, remember?
5
t
t
2
t
3
5
p
(t) =
Ct
=
c
0
c
1
c
2
c
3
|
,
|
|
|
where
p
(t) and each of the coe
cient vectors
c
i
are column vectors whose
height matches the number of geometric dimensions (1D, 2D, or 3D). The
height of
t
matches the number of
c
's, which depends on the degree of the
curve.
The coe
cient matrix
C
may be expressed as a matrix product by
putting the Hermite positions and velocities as columns in a matrix
P
and
multiplying by a conversion matrix
H
:
2
4
1
3
5
2
4
1
3
5
2
4
| | | |
3
0
−3
2
Cubic Hermite curve
using matrix notation
0
1
−2
1
t
t
2
t
3
5
p
(t) =
Ct
=
PHt
=
p
0
v
0
v
1
p
1
|
.
0
0
−1
1
|
|
|
0
0
3
−2
Search WWH ::
Custom Search