0% found this document useful (0 votes)
55 views13 pages

Beziercurve

This document provides information about Bezier curves. It discusses the Bernstein basis used to define Bezier curves parametrically using control points. It presents the matrix formulation of Bezier curves and discusses properties like derivatives and converting between Bezier curves and cubic splines. The key points covered are: - Bezier curves are defined parametrically using Bernstein basis polynomials of the control points - Higher degree curves are defined by more control points - Derivatives of Bezier curves are important for things like surface normals - Bezier curves can be converted to/from cubic splines by matching tangent vectors at endpoints

Uploaded by

ankit tyagi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
55 views13 pages

Beziercurve

This document provides information about Bezier curves. It discusses the Bernstein basis used to define Bezier curves parametrically using control points. It presents the matrix formulation of Bezier curves and discusses properties like derivatives and converting between Bezier curves and cubic splines. The key points covered are: - Bezier curves are defined parametrically using Bernstein basis polynomials of the control points - Higher degree curves are defined by more control points - Derivatives of Bezier curves are important for things like surface normals - Bezier curves can be converted to/from cubic splines by matching tangent vectors at endpoints

Uploaded by

ankit tyagi
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 13

AML710 CAD

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 )!

J 3,0 (t ) = (1 t ) 3 ; J 3,1 (t ) =3t (1 t ) 2 ; J 3, 2 (t ) = 3t 2 (1 t ); J 3,3 (t ) = t 3


1
j3,0
j3,1
j3,2
j3,3

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

Properties of the basis function

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

Properties of the basis function

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

Maximum value of Blending functions

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 = ?

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

Properties of the basis function

For any given value of the parameter t, the summation of the


basis functions is exactly equal to 1 i.e.,
n

J
i =0

n ,i

(t ) = 1

1
0.5

0.5

Properties of the basis function

The curve is always contained within the convex hull of the


control points, it never oscillates wildly away from the control
points.
If there is only one control point B0, ie: n=0 then P(t) = B0 for all
t.
If there are only two control points P0 and P1, ie: n=1 then the
formula reduces to a line segment between the two control
points.

Properties of the basis function

J n ,i (t ) =

n!
t i (1 t ) n i
i!(n i )!

The blending function is always a polynomial of degree one


less than the number of control points.

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)

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

x=[1 2 2,2 3];

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

Matrix formulation of Bezier Curve


We can think of a matrix formulation now for Bezier curve. Consider a
cubic Bezier curve

P(t ) = [F ][G ] = [T ][N ][G ]

Where [F] is the blending function matrix given by

[F ] = [J n,0

[F ] = [(1 t )3

J n ,1 ... J n ,n 1
3t (1 t ) 2

P(t ) = [T ][N ][G ] = t 3 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

Matrix formulation of Bezier Curve


We can extend this now to a quartic, for n=4, Bezier curve

P(t ) = [F ][G ] = [T ][N ][G ]

P(t ) = [T ][N ][G ] = t 4

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

Derivatives of Bezier Curve


We require the derivatives of a Bezier curve :
For determining slope and curvature continuities while joining segments
For surface normal calculations needed in lighting and numerical tool
path calculations etc
n

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 )

Numerical evaluation of the above derivatives have problems at t=0,n

Derivatives of Bezier Curve


An alternate way for obtaining rth derivative at t=0 and t=1 i,e at the ends
of the segment is respectively given as:

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) = n(n 1)( B0 2 B1 + B2 ) ;


P(1) = n(n 1)( Bn 2 Bn 1 + Bn 2 )

Converting Bezier to/from Cubic spline


The derivatives defined earlier will be used to approximate the tangent
vectors at the ends. Thus the first derivatives for the ends for cubic Bezier
curve 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 )]

In a similar way we can convert a cubic spline back to Bezier by


appropriately using the end tanget vectors to define Bi:

[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 : Closed Bezier curves

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

Geometric Construction by De Casteljau


Casteljaus algorithm provides a method for geometrically constructing
the Bezier curve. In th following example construction of a cubic Bezier is
demonstrated.
b
h

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

You might also like