Game Development Reference
In-Depth Information
1
2
TPP .
(
)
(11.43)
=
i
i
+
1
i
1
()
We can express each piece
i t
of the spline, where 1
≤≤ −
in
2
, as a Hermite
C
curve having the endpoints P and
P
and the tangents T and
T
:
i
+
1
i
+
1
1

 
 
t
() [
]
C
t
=
PP TTM
.
(11.44)
i
i
i
+
1
i
i
+
1
H
2
 
 
t
t
3
We would like to find a basis matrix
M
that allows us to express the geometry
CR
matrix
G
as four points, so we observe the following.
CR
00
0
1
2
10 0
01
1
2
[
][
]
PP TT
=
P PP P
(11.45)
i
i
+
1
i
i
+
1
i
1
i
i
+
1
i
+
2
0
1
2
00 0
1
2
Substituting this into Equation (11.44) shows us that the basis matrix C M must
be the product of the rightmost matrix in Equation (11.45) and the Hermite basis
matrix
M
. Thus,
H
00 1 0 10 3 2
0 1 2
1

 

 
20 0
100 3
2
2 0
5 3
1
1

 
M
=
=
, (11.46)
CR
2
02 1 0 01 2 1

 
2
0 1 4
3

 
00 0 1 00 1 1
0 0
1 1

 
and we can express the pieces of the Catmull-Rom spline as
1

 
 
t
() [
]
,
(11.47)
C
t
=
PPPPM
i
i
i
i
+
i
+
CR
1
1
2
2
 
 
t
t
3
]
where the geometry matrix is
G PPPP . Figure 11.8 shows an
example of a Catmull-Rom spline and illustrates how the tangent at each point is
parallel to the line segment connecting the two neighboring points.
=
[
CR
i
1
i
i
+
1
i
+
2