Graphics Reference
In-Depth Information
3.5
3
2.5
2
1.5
1
0.5
0
0
1
2
3
4
5
x
Fig. 9.12. A cubic Bezier line.
where ( x c 1 ,y c 1 )and( x c 2 ,y c 2 ) are points one-third and two-thirds between
the start and final values. As we found in the quadratic case, where the single
control point was halfway between the start and end values, we obtain linear
interpolation as shown in Figure 9.12.
Mathematicians are always interested in finding how to express formulae
in compact and precise forms, so they have devised an elegant way of abbrevi-
ating (9.11) and (9.14). Equation (9.11) describes the three polynomial terms
for generating a quadratic Bezier curve, and (9.14) describes the four poly-
nomial terms for generating a cubic Bezier curve. To begin with, quadratic
equations are called second-degree equations , and cubics are called third-degree
equations . In the original Bernstein formulation,
B i ( t )= n
t i (1
t ) n−i
(9.15)
i
n represents the degree of the polynomial, and i , which has values between
0and n , creates the individual polynomial terms. These terms are then used
to multiply the coordinates of the end and control points. If these points are
stored as a vector P , a point p ( t ) on the curve can be written as
p ( t )= n
i
t i (1
t ) n−i P i for 0
i
n
(9.16)
or
n
i
t i (1
n
t ) n−i P i
p ( t )=
(9.17)
i =0
or
n
B i ( t ) P i
p ( t )=
(9.18)
i =0
For example, a point p ( t ) on a quadratic curve is represented by
p ( t )=1 t 0 (1
t ) 2 P 0 +2 t 1 (1
t ) 1 P 1 +1 t 2 (1
t ) 0 P 2
(9.19)
Search WWH ::




Custom Search