You are on page 1of 67

M2-5: Geometric Modeling of

Synthetic Curves: Bezier Curve

Dr. Srinivasa Prakash Regalla, PhD


Professor, Department of Mechanical Engineering
BITS-Pilani, Hyderabad Campus
Learning Outcomes in this Segment

 Need for Bezier curve

 How Bezier curve is different from HCC?

 Geometric modeling of Bezier Curve:


 Derivative of parametric equation
 Properties of Bernstein polynomials
 Matrix representation of the parametric equation
 Tangent vector and normal vector
 Computer evaluation of Bezier curve
 Affine transformations of Bezier curve
Bezier Curves
• Approximator – Adds flexibility and intuitive feel in mechanical design
• Credited to P. Bezier; P. De Casteljau also developed independently
• Only control points (not necessarily only 2 per segment) form the input, no specification of tangent
vectors – provides more direct relation between input (points) and output (curve)
• The order of the Bezier is variable (unlike HCC) and depends on the number of control points, (n+1)
• (n+1) number of control points define an nth degree curve; (n+1) = 4; (k-1) = 3, or cubic
• we will term degree of curve as (k-1) (k-1) = 2; (n+1) = 3. – nearer to design

• Bezier curve can be smoother than HCC


• These control points form the vertices of the control polygon or Bezier characteristic polygon,
which uniquely defines the curve
P1 P2

P0 3
I/C, Regalla Srinivasa Prakash
P3
Exercise:
n+1 = 4
n = 4-1 =3
(k-1) = degree = n = 3
This Bezier curve is of degree __________. Or cubic.

P1 P2

P0
P3

Ans: cubic 4

I/C, Regalla Srinivasa Prakash


• Order of the control points is very essential because
changing the order can change the shape of the curve
• Thus, the curve shape tends to follow the control polygon
shape and thus easy to guess and sketch

I/C, Regalla Srinivasa Prakash 5


Parametric Equation of Bezier Curve
For the (n+1) control points, Pi the parametric equation of the Bezier curve is written as:

  
n • The functions Bi,n are the Bernstein

P u    Bi ,n u Pi Bi,n (u)  nCi u i (1  u) (ni )


polynomials of degree (k-1)=n
0  u 1 • We can write the complete form of
i 0 Bezier curve while observing that
C(n,0)=C(n,n)=1
P (u )  B0,n (u ) P0  B1,n (u ) P1  ...  Bn,n (u ) Pn

B0,n (u ) nC0u 0 (1  u ) n 0 
n!
.1.(1  u ) n  (1  u ) n P1 P2
(n  0)!0!
n! n.( n  1).(n  2)...1
B1,n (u ) nC1u1 (1  u ) n1  .u.(1  u ) n 1  .u.(1  u ) n1  n.u.(1  u ) n1
(n  1)!1! (n  1).(n  2)...1.(1)
n! n.( n  1) 2 u
B2,n (u ) nC2u 2 (1  u ) n2  .u 2 .(1  u ) n2  .u .(1  u ) n2
(n  2)!2! 2
...
n!
Bn,n (u ) nCnu n (1  u ) nn  .u n  u n
(n  n)!n!
n.( n  1) 2
P0
P (u )  (1  u ) n Po  n.u.(1  u ) n1 P1  .u .(1  u ) n2 P2  ...  u n Pn 0  u 1 P3
2
BITS Pilani, Hyderabad Campus
Exercise:

Develop the parametric equation of the cubic Bezier curve.


B0,3  3C0 * u 0 * (1  u ) (30)
Solution: For cubic Bezier curve, we need (n+1)=4 control points. 
3!
*1* (1  u ) 3  (1  u ) 3
(3  0)!0!

3 B1,3  3C1 * u1 * (1  u ) (31)


P u    Bi,3 u Pi 0  u 1 
3!
(3  1)!1!
* u * (1  u ) 2  3 * u * (1  u ) 2
i 0

P(u) = B0,3 * P0 + B1,3 * P1 + B2,3 * P2 +B3,3 *P3 B3,3


= ( 1 - u )3 * P0 + 3 * u * ( 1 - u )2 * P1 + 3 * u2 * ( 1 - u )* P2 +u3 *P3

BITS Pilani, Hyderabad Campus


I/C, Regalla Srinivasa Prakash 8
Exercise:

Develop the parametric equation of the quadratic Bezier curve.

BITS Pilani, Hyderabad Campus


Exercise:

Develop the parametric equation of the quadratic Bezier


curve.

Solution: For quadratic Bezier curve, we need (n+1)=3


control points.
P(u) = P0 * B0,2+ P1 * B1,2 + P2 B2,2
= P0 * ( 1 - u ) 2 + P1 * 2 * u ( 1 - u ) + P2 u2

BITS Pilani, Hyderabad Campus


Exercise:

Prove that for two control points, Bezier curve gives a


parametric straight line.

BITS Pilani, Hyderabad Campus


Exercise:

Prove that for two control points, Bezier curve gives a


parametric straight line.

Solution: Given two control points P0 and P1.

P(u) = P0 * B0,1+ P1 * B1,1


= P0 * ( 1 - u ) + P1 * u
= P0 +u(P1 - P0)

BITS Pilani, Hyderabad Campus


Exercise:

Prove that the Bezier curve (a) interpolates the first and last
control points (P0 and Pn), and (b) its tangents vector at
its first control point P0 is along first control polygonal
segment and that at end point Pn is along the last control
polygonal segment.

BITS Pilani, Hyderabad Campus


Solution:

P(u )  Po (1  u ) n  P1C (n,1)u (1  u ) n 1  P2C (n,2)u 2 (1  u ) n  2 


...  Pn1C (n, n  1)u n 1 (1  u )  Pnu n 0  u 1
• Substitute u=0 and u=1,…?
• The curve is tangent to the first and last segments of
control polygonal segments…proof?
• Deriving the parametric form “r” times

n! r
P (u  0) 
r
  1r i
C (r , i ) Pi
n  r ! i 0
n! r
P (u  1) 
r
  1i
C (r , i ) Pn i
n  r ! i 0

I/C, Regalla Srinivasa Prakash 14


n! r
P (u  0) 
r
  1r i
C (r , i ) Pi
n  r ! i 0
n! r
P (u  1) 
r
  1i
C (r , i ) Pn i
n  r ! i 0
1) The curve interpolates the first and last
control points.

• It passes through Po and Pn if we


substitute u=0 and u=1
P(u) = P0 * B0,3+ P1 * B1,3 + P2 B2,3+ P3 B3,3

= P0 * ( 1 - u )3 + P1 * 3 * u * ( 1 - u )2 + P2 * 3 * u2 * ( 1 - u ) + P3 * u3

I/C, Regalla Srinivasa Prakash 16


2) The curve is tangent to the first and last
curve segments of the control polygon.
n! r
P (u  0) 
r
  1r i
C (r , i ) Pi
n  r ! i 0
r
Pr (u  1) 
n!
  1i
C (r , i ) Pn i
n  r ! i 0
Substituting r  1, the first derivative s at the endpoints are
P' (u  0)  n(P1 Po )
P' (u  1)  n(Pn  Pn1 )
• Can you find the second derivative at P0? What
do you observe?
Ans: It is determined by Po, P1 and P2. In general, the rth derivative at
an endpoint is determined by its “r” neighbouring control points.
I/C, Regalla Srinivasa Prakash 17
Exercise:
Plot in Matlab the Bernstein polynomials of a cubic Bezier curve and comment
on their behaviour.
P(u) = P0 * B0,3+ P1 * B1,3 + P2 B2,3+ P3 B3,3

= P0 * ( 1 - u )3 + P1 * 3 * u * ( 1 - u )2 + P2 * 3 * u2 * ( 1 - u ) + P3 * u3

1.2

0.8 B0
B1
0.6
B2
0.4 B3

0.2

0
I/C, Regalla Srinivasa Prakash 18
Exercise: Propose suitable control point and their order to generate the
following Bezier curves. Verify the curve shapes by plotting in Matlab.

19
I/C, Regalla Srinivasa Prakash
Exercise: Prove that the Bezier curve is
symmetric with respect to u and (1-u).
Solution:
• That is, reversing the direction of parametrization does
not change the curve shape. To check this property
substitute 1-u = v.
• The symmetry of the Bezier curve is due to the
symmetry (NOT equality) of the Bernstein basis, which
in turn is due to the property of the binomial functions:
C(n, i) = C(n, n-i)
• Which makes Bi,n(u) and Bn-i,n(u) to be symmetric when
plotted with respect to u.
Be careful, Bi,n(u) ≠ Bn-i,n(u), never, except at u=0.5.

I/C, Regalla Srinivasa Prakash 20


Parametric Bezier Curve
Exercise:
Prove that the polynomial Bi,n has a maximum value of C(n,i)(i/n)i(1 – i/n)n-i occuring at u=i/n. Also
explain the significance of this observation.
Exercise: Prove that the polynomial Bi,n has a maximum
value of C(n,i)(i/n)i(1 – i/n)n-i occuring at u=i/n

Solution:
This can be obtained by setting dBi,n/du = 0
This means that each ith control point is most
influential on the shape of the curve at u=i/n,
where (n+1) are the total control points.
For example in a cubic Bezier curve defined by Po,
P1, P2 and P3, these points are most influential at
u=0, 1/3, 2/3 and 1.

I/C, Regalla Srinivasa Prakash 22


Exercise:
Google Classroom
• A cubic Bezier curves is to be reshaped by moving the third control point along the control
point. Which point on the curve will move most when this control point is moved?

A. The point at u=0


B. The point at u=1/3
C. The point at u=2/3
D. The point at u=1
The shape of the curve (for a given set of control
vertices) can be changed by two methods.

 By moving a control point


 By providing multiple control points at a vertex of
control polygon. Multiplicity of control points makes the
curve pulled towards that point.

Multiple
control
K=3 points
are
K=2 specified
K=1 here

I/C, Regalla Srinivasa Prakash 24


A closed Bezier curve can be obtained by
making Po and Pn coincident. Will the degree
of the curve change?

By making the
last point co-
incide with the
first point

By adding additional
control point at the
first point

I/C, Regalla Srinivasa Prakash 25


Partition of Unity Property:
For any valid value of u, for any degree of given
curve:
n

B
i 0
i ,n 1
This provides for
* invariance of Bezier curve (or invariance of the
relationship between the Bezier curve and its control
polygon) under affine transformations.

* Method to check numerical computation and software


developments.
I/C, Regalla Srinivasa Prakash 26
Positivity:
For any value of u, given any degree of
curve, each Bernstein polynomial satisfies

Bi ,n  0
This ensures that the Bezier curve lies
entirely in its convex hull.

I/C, Regalla Srinivasa Prakash 27


The Convex Hull Property of Bezier Curve

• A curve is said to have convex hull


property if it entirely lies in its convex hull
defined by its control polygon.

• The Bezier curve defined with Bernstein


polynomial basis possesses the convex
hull property

I/C, Regalla Srinivasa Prakash 28


How to get the Convex Hull of a Bezier curve?
• The convex hull of a Bezier curve is the
maximum area obtained by joining all
control points to all control points.

Example – 1 Convex Hull Example – 2


Degree = 3 (Hatched region) Degree = 3
I/C, Regalla Srinivasa Prakash 29
Convex Hull
(Hatched region)

Example – 3
Degree = ?

Example – 4
Degree = ?

I/C, Regalla Srinivasa Prakash 30


Consequences of Convex Hull Property
There are three important aspects:

1) Degeneration to a straight line: useful

2) Clipping like manipulations become easy

3) Wild oscillations of the curve about any


control point is avoided
I/C, Regalla Srinivasa Prakash 31
Exercise:
Find the relation between the three control points of quadratic
Bezier curve if it degenerates to a straight line.

Solution: Quadratic Bezier curve: P(u) = P0 * B0,2+ P1 * B1,2 + P2 B2,2


= P0 * ( 1 - u ) 2 + P1 * 2 * u ( 1 - u ) + P2 u2
Equating quadratic Bezier curve to a straight line:
P0 + u (P2 - P0 ) = P0 * ( 1 - u ) 2 + P1 * 2 * u ( 1 - u ) + P2 u2
RHS  P0 (1  u 2  2u )  P1 (2u  2u 2 )  P2u 2
 u 2 ( P0  2 P1  P2 )  u (2 P0  2 P1 )  P0
Equating the coefficients of individual exponential terms of the
polynomial on LHS and RHS;
Equating u 2 coefficients : ( P0  2 P1  P2 )  0 (1)
P1  ( P0  P2 ) / 2
Equating u coefficients : (2 P0  2 P1 )  P2  P0  (2)
P1  ( P0  P2 ) / 2 32
I/C, Regalla Srinivasa Prakash
(CONTD)

Example Matlab generation for degeneration of quadratic Bezier


curve when P0=[1,1], P2=[9,11] and P1=0.5*P0+0.5*P2:

BITS Pilani, Hyderabad Campus


(CONTD)

Example Matlab generation for degeneration of quadratic Bezier


curve when P0=[1,1], P2=[9,11] and P1=0.2*P0+0.8*P2:

BITS Pilani, Hyderabad Campus


I/C, Regalla Srinivasa Prakash 35
Composite Bezier Curves: Blending
• For Co continuity: the last control of the first Bezier
curve segment be coincided with the first point of the
second Bezier curve segment.
• For C1 continuity: The end slope of the first segment
need to be equal to the starting slope of the second
segment. This requires that the (n-1)th point of the first
segment, the joining point and the second point of the
second segment be collinear.
• Now:
(n+1) = Number of the control points of the first segment
(m+1) = Number of the control points of the second
segment
Equating the tangent vectors (a sufficient condition)
{n(Pn – Pn-1)}first segment = {m(P1 – Po)}second segment
{(Pn – Pn-1)}first segment = (m/n){(P1 – Po)}second segment
I/C, Regalla Srinivasa Prakash 36
Example
• If the first segment is formed by Po, P1, P2
and P3 and second segment is formed by
P4, P5, P6, P7 and P8, then P2, P3
(coinciding with P4) and P5 must be
collinear. Therefore
(P3 – P2)= (4/3)(P5 – P4)
P7
P2
P1 P4
P8
P3
P P5 P6
o I/C, Regalla Srinivasa Prakash 37
Exercise:

A cubic Bezier curve for P0=[1,1], P1=[3,6], P2=

BITS Pilani, Hyderabad Campus


Sub-Dividing Bezier Curves
de Casteljau’s Algorithm
• Step 1: Find the
midpoints of the
lines joining the
original control
vertices. Call them
M01, M12, M23

• Step 2: Find the midpoints of the lines joining M01, M12 and
M12, M23. Call them M012, M123
• Step 3: Find the midpoint of the line joining M012, M123. Call it
M0123
• The curve with control points P0, M01, M012 and M0123 exactly
follows the original curve from the point with u=0 to the point
with u=0.5
• The curve with control points M0123 , M123 , M23 and P3 exactly
follows the original curve from the point with u=0.5 to the point
with u=1 39
Regalla Srinivasa Prakash
Sub-Dividing Bezier Curves
M12
P1 P2
M012 M0123
M123

M01
M23

P0
P3

I/C, Regalla Srinivasa Prakash 40


de-Casteljau Algorithm applied to a
Quadratic Bezier Curve*
P0=[1,1]; P1=[2,6]; P2=[6,1]
Find the sub-division point on the Bezier curve at u=0.3.
Solution:

I/C, Regalla Srinivasa Prakash 41


*Phil Tregoning - Created using ImageMagicki
de-Casteljau Algorithm applied to a
Quadratic Bezier Curve*
P0=[1,1]; P1=[2,6]; P2=[6,1]
Find the sub-division point on the Bezier curve at u=0.3.
Solution:
First CP segment:
P(u=0.3)= [1,1]+0.3*([2,6]-[1,1])= [1.3,2.5]
Second CP segment:
P(u=0.3)= [2,6]+0.3*([6,1]-[2,6])= [3.2, 4.5]
Sub-division point= [1.3,2.5]+0.3*[3.2, 4.5]
= [2.26, 3.85]

I/C, Regalla Srinivasa Prakash 42


*Phil Tregoning - Created using ImageMagicki
de Casteljau’s Algorithm: u=0.25
• You can find the point on a Bezier curve for any
parameter value u with a similar algorithm
• Say you want u=0.25, instead of taking
midpoints take points 0.25 of the way

M12
P1 P2

M23
t=0.25

M01

P0
P3
I/C, Regalla Srinivasa Prakash 43
Exercise:
Using de Castejau algorithm sub-
Division of Cubic Bezier curve for
various parameter values
P1 P2

P0
P3
I/C, Regalla Srinivasa Prakash 44
Bezier Curve
Exercise:
What is the main purpose of De Castejau Algorithm for Bezier curve?

(A) It helps blend two Bezier curves with C1 continuity


(B) It helps subdivide a Bezier curve at the desired parameter value
(C) It helps subdivide the control polygon of a Bezier curve
(D) It helps make the Bezier curve interpolate the intermediate control points
Who invented Bezier curve?

• Bézier curve is attributed and named after


a French engineer, Pierre Bézier, who
used them for the body design of the
Renault car in the 1970's.

I/C, Regalla Srinivasa Prakash 46


What are the applications of Bezier curve, past and
present?

• They have since obtained dominance in the typesetting


industry and in particular with the Adobe Postscript and
font products.

I/C, Regalla Srinivasa Prakash 47


If only one control point is given, what will be
the Bezier curve?
Solution:
If there is only one control point P0, i.e., n=0,
then P(u) = P0 for all u.

I/C, Regalla Srinivasa Prakash 48


Exercise: If there are only two control points
P0 and P1, what will be the nature of Bezier
curve?
Solution:
i.e., n=1, then the formula reduces to a line
segment between the two control points.
1
P(u )   Pi Bi ,1 (u ) P0 B0,1 (u )  P1B1,1 (u )
i 0

 Po (1  u )  P1u  Po  u P1  Po  0  u 1

I/C, Regalla Srinivasa Prakash 49


• Prove that the Bezier curve with Bernstein
polynomials in general does not pass
through any of the control points except
the first and last.

Solution:
From the formula P(0) = P0 and P(1) = Pn.

I/C, Regalla Srinivasa Prakash 50


Exercise: Prove that the curve is always
contained within the convex hull of the
control points and that it never oscillates
wildly away from the control points.

Solution: Positivity property.

I/C, Regalla Srinivasa Prakash 51


Exercise: How do you obtain the closed Bezier curve?
What is the effect on the degree of the curve?

Solution: 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.

I/C, Regalla Srinivasa Prakash 52


Exercise: What is meant by multiplicity of control points and
what is the consequence of it? Will multiple control points at a
coordinate location change the degree of the curve?
Solution:
Adding multiple control points at a single position in space will
add more weight to that point "pulling" the Bézier curve
towards it.

I/C, Regalla Srinivasa Prakash 53


Exercise: Why it is necessary to blend multiple Bezier curve segments
to model a part represented by a set of data points, instead of building
a single curve?

Solution:

As the number of control points increases it is necessary to have higher


order polynomials and possibly higher factorials. It is common
therefore to piece together small sections of Bézier 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.

I/C, Regalla Srinivasa Prakash 54


Exercise: Does Bezier curve provide C2
continuity at the blend point?
Solution;
Second order continuity at blend points is
generally not possible.

I/C, Regalla Srinivasa Prakash 55


Exercise: Is it possible to build two parallel
Bezier curves?
Solution:
Except for the redundant cases of 2 control
points (straight line), it is generally not
possible to derive a Bézier curve that is
parallel to another Bézier curve. It isn't
possible to create a Bézier curve that is
parallel to another, except in the trivial
cases of coincident parallel curves or
straight line Bézier curves.
I/C, Regalla Srinivasa Prakash 56
Exercise: Can a circle be exactly
represented by a Bezier curve?

Solution:

A circle cannot be exactly represented with


a Bézier curve.

I/C, Regalla Srinivasa Prakash 57


Exercise What are the advantages of Bezier
curve? Is it possible to build interpolating
Bezier curve?
Solution:
Bézier curves have wide applications
because they are easy to compute and
very stable. There are similar formulations
which are also called Bézier curves which
behave differently, in particular it is
possible to create a similar curve except
that it passes through the control points.
I/C, Regalla Srinivasa Prakash 58
How the degree of Bezier curve is decided? Is the
curve ever symmetric?

Soution:
The degree of the curve is
one less than the number of
control points, so it is a
quadratic for 3 control
points. It will always be
symmetric for a symmetric
control point arrangement.

I/C, Regalla Srinivasa Prakash 59


Courtesy: http://astronomy.swin.edu.au/~pbourke/curves/bezier/
What is the advantage of tangency of Bezier curve to the
first and last control polygonal segments?

• The curve always passes


through the end points and
is tangent to the line
between the last two and
first two control points.
This permits ready piecing
of multiple Bézier curves
together with first order
continuity.
I/C, Regalla Srinivasa Prakash 60
What is meant by the curve “well behaving”?

• The curve always lies within the convex


hull of the control points. Thus the curve
is always "well behaved" and does not
oscillating erratically.

61
Courtesy: http://astronomy.swin.edu.au/~pbourke/curves/bezier/
What are the limitations of Bezier Curve?

Solution:
• When interpolation is required, Bezier curve can not provide that
feature.
• There is no local control, only global control is available
• When a large number of control points are to be modeled by a
single curve segment, Bezier curve is practically impossible
because the degree of the curve has to be very high, exactly one
less than the number of control points. Moreover, it will only be
local control over the entire portion the curve.

I/C, Regalla Srinivasa Prakash 62


What is invariance of Bezier curve?
• Translational invariance means that translating the control points
and then evaluating the curve is the same as evaluating and then
translating the curve
• Rotational invariance means that rotating the control points and then
evaluating the curve is the same as evaluating and then rotating the
curve
• These properties are essential for parametric curves used in
graphics
• It is easy to prove that Bezier curves, Hermite curves and everything
else we will study are translation and rotation invariant
• Some forms of curves, rational splines, are also perspective
invariant
– Can do perspective transform of control points and then evaluate the
curve

I/C, Regalla Srinivasa Prakash 63


• Prove that a general curve such as a
Bezier or B-Spline is to be translated, the
invariance property is valid.
• Solution: Invariance means translating the
control points and then generating the
curve give the same result as translating
the original curve.
• Let d be the translation vector and Pi and
Pi* be the original and translated control
points of the general curve.

64
4/26/2021
Let us take Bezier curve.
n n
P * (u )   Pi Bi,n(u)   (Pi  d)Bi,n(u)
*

i 0 i 0
n n
  Pi Bi,n(u)  d Bi,n(u)  Pi (u )  d
i 0 i 0

Thus generating the Bezier curve and then translating it is equivalent to


translating its control points first and then generating it.
In the above proof, we used the property that the sum of the Bi,n functions
is always unity.
Let us now take the B - Spline curve. In similar procedure,
n n
P * (u )   Pi N i,k(u)   (Pi  d)N i,k(u)
*

i 0 i 0
n n
  Pi N i,k(u)  d N i,k(u)  Pi (u )  d
i 0 i 0

because the B - Spline basis functions also possess the property


n
that  N i,k  1 65
i 1 4/26/2021
Exercise:

Using minimum variety of analytic and synthetic curves,


generate the wire-frame modelling of the computer
mouse, whose images from different angles are given
below.

P5

P4 P1
straightline
P3
P3 P2

BITS Pilani, Hyderabad Campus


I/C, Regalla Srinivasa Prakash 67

You might also like