Professional Documents
Culture Documents
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).
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
(t ) = (1 t ) 3 ; J (t ) = 3t(1 t ) 2 ; J
3,1 3, 2
(t ) = 3t 2 (1 t ); J
3, 3
(t ) = t 3
P (t ) = B0 J 3, 0 (t ) + B1 J 3,1 (t ) + B2 J 3, 2 (t ) + B3 J 3,3 (t )
2 3 = (1 t ) 3 P0 + 3t (1 t ) 2 P 1 + 3t (1 t ) P 2 +t P 3
Blending functions
P(t ) = Bi J n ,i (t ) and J n ,i (t ) =
i =0 n
n! 6 t i (1 t ) n i = t i (1 t ) n i i!(n i )! i!(3 i )!
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
Blending functions
B1
For
n = 2,3,4.....
1
0.5
B0 B1 B2 B1 B0
B2 B3
0.5
1 0.5
0.5
B3 B0
B2
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.
i=0 i0
1 0.5
P(0) = B0 J n , 0 (0) = B0
0 1
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)
i=n in
1 0.5
P(1) = Bn J n ,n (1) = Bn
0 1
0.5
It is observed that the blending functions are quite symmetric in nature The maximum value occurs at:
max( J n ,i (t )) = d ( J n ,i (t )) dt = 0; t = ? i i ( n i ) n i nn
i max( J n ,i (t )) = J n ,i ( n )= n ci
1 0.5
E.g .
0 1
0.5
Ans
J
i =0
n ,i
(t ) = 1
1 0.5
0 1
0.5
J n ,i (t ) =
n! t i (1 t ) n i i!(n i )!
The blending function is always a polynomial of degree one Thus 3 control points result in a parabola, 4 control points a
cubic curve etc. Closed curves can be generated by making the last control point the same as the first control point. First order continuity can be achieved by ensuring the tangent between the first two points and the last two points are the same. Adding multiple control points at a single position in space will add more weight to that point "pulling" the Bzier curve towards it.
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) Y(t)
1.0 1.0
1.326 1.54
1.688 1.96
2.062 2.26
2.424 2.44
2.75 2.5
3.016 2.44
3.198 2.26
3.272 1.96
3.214 1.54
3.0 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
0.5
1.5
2.5
3.5
2.062 1.378
2.424 1.576
2.75 1.75
3.016 1.864
3.198 1.882
3.272 1.768
3.214 1.486
3 1
1 1.054
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
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
J n ,n ]
[F ] = [(1 t )3
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 B 0 1 0 B2 0 B3
t3 t2
6 4 1 4 4 12 12 4 t 1 6 12 6 0 0 0 4 4 0 0 0 1
1 B0 0 B1 0 B2 0 B3 0 B4
,i (t ) J n ,i (t )= n ci {it i 1 (1 t ) n i (n i )t i (1 t ) n i 1} P(t ) = Bi J n
i =0 n i ) ( n i ) i = n ci t i (1 t ) n i { ti ((1 t ) } = { t (1t ) }J n ,i (t ) = ( i nt ) t (1t )
J n ,i (t )
,i (t ) P(t ) = J n
i =0
,i (t ) = Jn
( 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)
i =0 r i =0
r i r
ci Bi
n! ( n r )!
(1)
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
[G ] = 1 P
B3 3( B1 B0 ) 3( B3 B2 )]
1 1 ' (P ( P2 P2' ) P2 1+P 1) 3 3
In a similar way we can convert a cubic spline back to Bezier by appropriately using the end tanget vectors to define Bi:
T
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)
P (t ) = Bi J n ,i (t ) = Q( s ) = Bn i J n i ,i ( s )
i =0 i =0
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
The curve always lies within the convex hull of the control points. Thus the curve is always "well behaved" and does not oscillate erratically.
Closed curves are generated by specifying the first point the same as the last point. If the tangents at the first and last points match then the curve will be closed with first order continuity.. In addition, the curve may be pulled towards a control point by specifying it multiple times.
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
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