Beziercurve
Beziercurve
LECTURE 13
Bezier Curves
Bernstein Basis
Matrix formulation
Conversion to Cubic
De Casteljaus Geometric Construction
Bezier Curve
P(t) is a continuous function in 3 space defining the curve
with N discrete control points Bi. t=0 at the first control point
(i=0) and t=1 at the last control point (i=N).
t=1
P(t)
t=0
Bezier Curve
A Bezier Curve is obtained by a defining polygon.
Application:
Where aesthetic appeal is more important than accuracy.
Sometimes functional requirements demand such a curve.
Ab initio designs may need such curves
B1
B2
P(t ) = Bi J n ,i (t )
i =0
B0
B3
n!
6
and J n ,i (t ) =
t i (1 t ) n i =
t i (1 t ) n i
i!(n i )!
i!(3 i )!
(t ) = (1 t ) 3 ; J (t ) = 3t(1 t ) 2 ; J
J
3, 0
3,1
(t ) = 3t 2 (1 t ); J
3, 2
(t ) = t 3
3, 3
P (t ) = B0 J 3, 0 (t ) + B1 J 3,1 (t ) + B2 J 3, 2 (t ) + B3 J 3,3 (t )
= (1 t ) 3 P0 + 3t (1 t ) 2 P1 + 3t 2 (1 t ) P2 + t 3 P3
Blending functions
n
P(t ) = Bi J n ,i (t ) and J n ,i (t ) =
i =0
n!
6
t i (1 t ) n i =
t i (1 t ) n i
i!(n i )!
i!(3 i )!
0.9
0.8
0.7
0.6
0.5
0.4
0.3
0.2
0.1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Blending functions
n = 2,3,4.....
For
B1
1
0.5
B0
B1
B2
B2
0.5
0.5
0.5
B3
0.5
B3
B1
B0
B2
B0
0.5
The curve in general does not pass through any of the control
points except the first and last. From the formula P(0) = B0 and
P(1) = Bn.
n!(1)(1 0) n 0
=1
J n , 0 ( 0) =
n!
n!(0)i (1 0) n i
J n ,i (0) =
=0
i!(n i )!
i=0
i0
P(0) = B0 J n , 0 (0) = B0
1
0.5
0.5
The curve in general does not pass through any of the control
points except the first and last. From the formula P(0) = B0 and
P(1) = Bn.
J n ,n (1) =
n!(1)(0) n n
=1
n!(1)
n!(1) i (0) n i
J n ,i (1) =
=0
i!(n i )!
i=n
1
in
0.5
P(1) = Bn J n ,n (1) = Bn
0.5
d ( J n ,i (t ))
dt
= 0; t = ?
max( J n ,i (t )) = J n ,i ( ni )= n ci
E.g .
i i ( n i ) n i
nn
J 3,1( 13 ) = ?
0.5
J 3, 2( 23 ) = ?
Ans
0.5
J 3,1( 13 ) =
4
9
J 3, 2( 23 ) =
4
9
J
i =0
n ,i
(t ) = 1
1
0.5
0.5
J n ,i (t ) =
n!
t i (1 t ) n i
i!(n i )!
Example
% Bezier curve for n=3. Example 5.7 R&A
t=0:.01:1;
x=[1 2 4 3];
y=[1 3 3 1];
px=(1-t).^3*x(1)+3*t.*(1-t).^2*x(2)+3*t.^2.*(1-t)*x(3)+t.^3*x(4);
py=(1-t).^3*y(1)+3*t.*(1-t).^2*y(2)+3*t.^2.*(1-t)*y(3)+t.^3*y(4);
plot(x,y); hold
3
plot(px,py,'r');
axis([0 4.2 0 3.2]);
2.5
2
1.5
0.5
0.5
1.5
2.5
3.5
X(t)
1.0
1.326
1.688
2.062
2.424
2.75
3.016
3.198
3.272
3.214
3.0
Y(t)
1.0
1.54
1.96
2.26
2.44
2.5
2.44
2.26
1.96
1.54
1.0
Example
% Bezier curve for n=3. Example 5.7 R&A, one data pt altered
t=0:.01:1;
x=[1 2 4 3];
y=[1 1 3 1];
px=(1-t).^3*x(1)+3*t.*(1-t).^2*x(2)+3*t.^2.*(1-t)*x(3)+t.^3*x(4);
py=(1-t).^3*y(1)+3*t.*(1-t).^2*y(2)+3*t.^2.*(1-t)*y(3)+t.^3*y(4);
plot(x,y); hold
3
plot(px,py,'r');
2.5
axis([0 4.2 0 3.2]);
2
1.5
0.5
1.326 1.688
1 1.054
1.192
0.5
1.5
2.5
3.5
2.062
2.424
2.75
3.016
3.198
3.272
3.214
1.378
1.576
1.75
1.864
1.882
1.768
1.486
Example
% Bezier curve for n=3. Example 5.7 R&A, repeat 2 points
t=0:.01:1;
x=[1 2 2 3];
y=[1 3 3 1];
px=(1-t).^3*x(1)+3*t.*(1-t).^2*x(2)+3*t.^2.*(1-t)*x(3)+t.^3*x(4);
py=(1-t).^3*y(1)+3*t.*(1-t).^2*y(2)+3*t.^2.*(1-t)*y(3)+t.^3*y(4);
plot(x,y); hold
plot(px,py,'r');
3
axis([0 4.2 0 3.2]);
2.5
3
2
2.5
1.5
2
1
1.5
0.5
0.5
y=[1 3 3 1];
0
0.5
1.5
2.5
3.5
0.5
1.5
2.5
3.5
Example
% Bezier curve for n=3. Example 5.7 R&A, closed curve, 1st and 4th pts same
t=0:.01:1;
x=[1 2 4 1];
y=[1 3 3 1];
px=(1-t).^3*x(1)+3*t.*(1-t).^2*x(2)+3*t.^2.*(1-t)*x(3)+t.^3*x(4);
py=(1-t).^3*y(1)+3*t.*(1-t).^2*y(2)+3*t.^2.*(1-t)*y(3)+t.^3*y(4);
plot(x,y); hold
plot(px,py,'r');
3
axis([0 4.2 0 3.2]);
2.5
1.5
0.5
0.5
1.5
2.5
3.5
[F ] = [J n,0
[F ] = [(1 t )3
J n ,1 ... J n ,n 1
3t (1 t ) 2
J n ,n ]
3t 2 (1 t ) t 3 [B0
1 3 3
3 6 3
t 1
3 3
0
0
0
1
B1
B2
B3 ]
1 B0
0 B1
0 B2
0 B3
t3 t2
6 4
1 4
4 12 12 4
t 1 6 12 6
0
0
0
4 4
1
0
0
0
1 B0
0 B1
0 B2
0 B3
0 B4
P(t ) = Bi J n ,i (t ) J n ,i (t )= n ci {it i 1 (1 t ) n i (n i )t i (1 t ) n i 1}
i =0
= n ci t i (1 t ) n i { ti ((1nti)) } = { ti ((1nti)) }J n ,i (t ) =
( i nt )
t (1t )
J n ,i (t )
P(t ) = J n,i (t )
i =0
J n,i (t ) =
( i nt ) 2 nt 2 i (1 2 t )
t 2 (1t ) 2
)J
n ,i
(t )
P(0) =
P(1) =
n!
( n r )!
(1)
r i r
i =0
ci Bi
n!
( n r )!
(1)
i =0
ir
ci Bn i
Thus the first derivatives for the ends are respectively given as:
P(0) = n( B1 B0 ) ;
P(1) = n( Bn Bn 1 )
Also, the second derivatives for the ends are respectively given as:
P(0) = 3( B1 B0 ) ;
P(1) = 3( B3 B2 )
Substituting these values for the tangent vectors we get the equivalent
cubic spline Geometry matrix as :
[G ] = [B0
B3 3( B1 B0 ) 3( B3 B2 )]
[G ] = P1
1
1
( P1 + P1' )
( P2 P2' ) P2
3
3
10
Multi-segment curve
As the number of control points increases it is necessary to
have higher order polynomials and hence higher factorials. It
is common therefore to piece together small sections of Bzier
curves to form a longer curve. This also helps control local
conditions, normally changing the position of one control point
will affect the whole curve. Of course since the curve starts
and ends at the first and last control point it is easy to
physically match the sections. It is also possible to match the
first derivative since the tangent at the ends is along the line
between the two points at the end.
Second order continuity is generally not possible.
Direction of Parameterization
The curve is symmetric with respect to t and (1-t)
i =0
i =0
P (t ) = Bi J n ,i (t ) = Q( s ) = Bn i J n i ,i ( s )
where s = (1 t )
0 t 1
Note that when we have t as parameter then the curve is drawn from P0 to P4
while considering s as parameter we draw it form P4 to P0. Both produce the
same curve. Hence direction of parameterization does not change the curve
11
Example
The pink line shows the polygon formed by the control
points, the black line is the Bezier curve. Note that the
curve lies within the convex hull of the points. Note also
that the tangent of the curve at the endpoints is the same
as the slope of the line between the first two or last two
control points. This makes for convenient matching of the
curve between sections.
12
f
j
c
i
e
g
a
d
For the case of a cubic Bezier, we consider the three limbs of the open
control polygon ab, bc, and cd. Next create the intermediate points e, f
and g in the ratios ae/ab=bf/bc=cg/cd=t (given value of the parameter).
Continuing iteratively we obtain the point j on the curve. Similarly a series
of values of t give rise to the corresponding ratios and hence the points
on the Bezier curve.
13