Game Development Reference
In-Depth Information
Evaluating the functions
B and
B for
Q and
Q gives us the following formu-
P
()
las for the interior control points of
u
.
B
Q
(
)
Q
=−
1
1
s
PP
QP
+
s
1
0
1
(
)
=−
s
+
s
(11.34)
0
1
(
) (
)
]
(
)
]
=−
1
1
s
PP
+
s
+
s
1
s
PP
+
s
Q
s
[
[
2
0
1
1
2
(
)
[
(
)
]
=−
1
s
Q
+
s
1
s
P
+
s
P
(11.35)
1
1
2
R ,
R ,
R , and
R of the
We repeat a similar procedure for the control points
()
curve
B
v
:
R
()
RB
=
s
0
P
1
s
()
()
RB
=
s
+
B
s
1
P
P
3
1
s
()
()
RB
=
1
B
1
2
P
P
3
()
RB
=
1
=
P
.
(11.36)
3
P
3
()
Formulas for the interior control points of
B
v
are found by evaluating the
R
functions
B and
B as follows.
P
(
)
R
=−
1
1
P P
PR
+
s
s
2
2
3
=−
(
s
)
+
s
(11.37)
2
3
]
]
(
) (
)
(
)
R
=−
1
s
[
1
s
P
+
s
P
+
s
[
1
s
P
+
s
P
1
1
2
2
3
[
]
(
) (
)
=−
1
s
1
s
PP R
+
s
+
s
(11.38)
1
2
2
Finally, we take a look at the value of
Q
=
R . This is the point where the line
3
0
()
segment connecting
Q and
R is tangent to the curve
P t
. If we evaluate
B
()
and compare it to Equations (11.35) and (11.38), we see that
B
s
P
() (
)
=−
1
s
QR .
+
s
(11.39)
B
s
P
2
1
The entire procedure that we just went through leads us to the formulation of
the de Casteljau algorithm. As illustrated in Figure 11.7, we begin by connecting
adjacent pairs of the four control points P ,
P ,
P , and P , creating three line
1
2 P by linearly interpolating
the endpoints of each of the line segments using the parameter value s as follows.
()
1
()
1
()
segments. We then construct the points
P
,
P
, and
0
()
1
(
)
P
=−
1
s
P
+
s
P
(11.40)
i
i
i
+
1