You are on page 1of 52

Computer Aided Design and Manufacturing

Course Code: ME-308


Instructor
Dr. Deepak Kumar
Room No: 116, Department of Mechanical Engineering
Email: deepakkumar@mmumullana.org
M#8059931047

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Bezier Curves
Different choices of basis functions
give different curves
Choice of basis determines how the
control points influence the curve
In Hermite case, two control points
define endpoints, and two more define
parametric derivatives
For Bezier curves, two control
points define endpoints, and two
control the tangents at the
endpoints in a geometric way
Maharishi Markandeshwar University
Computer Aided Design and Manufacturing
Control Point Interpretation

Point along start tangent

x2
x3
End Point

x0 x2
Start Point Point along end Tangent

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Bezier Curves of Varying Degree

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Bzier Curves
Bzier splines are:
spline approximation method;
useful and convenient for curve and surface design;
easy to implement;
available in Cad system, graphic package, drawing and
painting packages.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Bzier Curves
In general, a Bzier curve section can be fitted
to any number of control points.
The number of control points to be
approximated and their relative position
determine the degree of the Bzier polynomial.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

Coordinate points can be blended to produced the following position vector


P(u), which describes the path of an approximating Bzier polynomial function
between P0 and Pn.

n
P (u ) PB
i i ,n (u ),0 u 1 (10)
i 0

ere P(u) is any point on the curve and Pi is a control point. Bi,n are the Bernstein
ynomials. Thus, the Bezier curve has a Bernstein basis. The Bernstein polynomia
ves as the blending or basis function for the Bezier curve and given by
Bi ,n (u ) C (n, i )u i (1 u ) ni

Where C (n,i) is the binomial coefficient


n!
C ( n, i )
i !(n i )!

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
n
P (u ) PB
i i ,n (u ),0 u 1 (10)
i 0

Expanding Eq (10) and utilizing C(n,0)=C(n,n)

n 1
P(u ) P0 (1 u ) n PC
1 ( n,1)u (1 u ) P2C (n, 2)u 2 (1 u ) n2 .... Pn1C (n, n 1)u n1 (1 u ) Pnu n ,0 u 1

B0,3 (u ) (1 u )3 B1,3 (u ) 3u (1 u ) 2 B2,3 (u ) 3u 2 (1 u )

B3,3 (u ) u 3
P (u ) P0 B0,3 (u ) PB
1 1,3 (u ) P2 B2,3 (u ) P3 B3,3 (u )

P(u ) (1 u )3 P0 3u (1 u ) 2 P1 3u 2 (1 u ) P2 u 3 P3

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
The vertices of the Bezier polygon are numbered from 0 to n.

Properties of Bezier curve


- The basis functions are real.
- The degree of the polynomial defining the curve segment is one
less than the number of defining polygon points.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
- The curve generally follows the shape of the defining
polygon.
- The first and last points on the curve are coincident with
the first and last points of the defining polygon.
- The tangent vectors at the ends of the curve have the
same direction as the first and last polygon spans,
respectively.
- The curve is contained within the convex hull of the
defining polygon, i.e., within the largest convex
polygon obtainable with the defining polygon vertices
- The curve is invariant under an affine transformation.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
% Bezier curve for n=3.
u=0:.01:1;
x=[1 2 4 3];
y=[1 3 3 1];
px=(1-u).^3*x(1)+3*u.*(1-u).^2*x(2)+3*u.^2.*(1-
u)*x(3)+u.^3*x(4);
py=(1-u).^3*y(1)+3*u.*(1-u).^2*y(2)+3*u.^2.*(1-
u)*y(3)+u.^3*y(4);
plot(x,y); hold
plot(px,py,'r');
axis([0 4.2 0 3.2]);

X(u)
Y(u)

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

Example
% Bezier curve for n=3.
u=0:.01:1;
x=[1 2 4 3];
y=[1 1 3 1];
px=(1-u).^3*x(1)+3*u.*(1-u).^2*x(2)+3*u.^2.*(1-
u)*x(3)+u.^3*x(4);
py=(1-u).^3*y(1)+3*u*(1-u).^2*y(2)+3*u.^2.*(1-
u)*y(3)+u.^3*y(4);
plot(x,y); hold
plot(px,py,'r');
axis([0 4.2 0 3.2]);

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Example
% Bezier curve for n=3.
u=0:.01:1;
x=[1 2 4 1];
y=[1 3 3 1];
px=(1-u).^3*x(1)+3*u.*(1-t).^2*x(2)+3*u.^2.*(1-
u)*x(3)+u.^3*x(4);
py=(1-u).^3*y(1)+3*u.*(1-u).^2*y(2)+3*u.^2.*(1-
u)*y(3)+u.^3*y(4);
plot(x,y); hold
plot(px,py,'r');
axis([0 4.2 0 3.2]);

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Matrix formulation of Bezier Curve
Consider a cubic Bezier curve
P (u ) [ F ][G ] [U ][ N ][G ]
Where [F] is the blending matrix given by

[ F ] [ B0,n , B1,n ,.....Bn1,n , Bn ,n ]

[ F ][G ] (1 u )3 3u (1 u ) 2 3u 2 (1 u ) u 3 [ P0 P1 P2 P3 ]T

1 3 3 1 P0
3 6 3 0 P
P(u ) [ F ][G ] [U ][ N ][G ] u 3 u 2 u 1 1
3 3 0 0 P2

1 0 0 0 P3

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
trix formulation of Bezier Curve

We can extend this now to a quadratic, for n=4,


Bezier curve
P (u ) [ F ][G ] [U ][ N ][G ]

1 4 6 4 1 P0
4 12 12 4 0 P
1
P (u ) [ F ][G ] [U ][ N ][G ] u 4 u 3 u 2 u 1 6 12 6 0 0 P2

4 4 0 0 0 P3
1 0 0 0 0 P 4

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis: Motivation
Consider designing the profile of a vase.
The left figure below is a Bzier curve of degree 11; but, it is difficult to bend the "neck" toward the line segment
P4P5.
The middle figure above uses this idea. It has three Bzier curve segments of degree 3 with joining points marked
with yellow rectangles.
The right figure above is a B-spline curve of degree 3 defined by 8 control points .

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis: Motivation
Those little dots subdivide the B-spline curve into curve segments.
One can move control points for modifying the shape of the curve just like what we do to Bzier
curves.
We can also modify the subdivision of the curve. Therefore, B-spline curves have higher degree of
freedom for curve design.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis: Motivation
Subdividing the curve directly is difficult to do. Instead, we subdivide the domain of the
curve.
The domain of a curve is [0,1], this closed interval is subdivided by points called knots.
These knots be 0 <= u0 <= u1 <= ... <= um <= 1.
Modifying the subdivision of [0,1] changes the shape of the curve.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis: Motivation
In summary :to design a B-spline curve, we need a set of control
points, a set of knots and a set of coefficients, one for each control
point, so that all curve segments are joined together satisfying
certain continuity condition.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis: Motivation

The computation of the coefficients is perhaps the most complex


step because they must ensure certain continuity conditions.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

B-Spline Curves

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Curves
(Two Advantages)
1. The degree of a B-spline polynmial can
be set independently of the number of
control points.

2. B-splines allow local control over the


shape of a spline curve (or surface)

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Curves
(Two Advantages)
A B-spline curve that is defined by 6
control point, and shows the effect of
varying the degree of the polynomials
(2,3, and 4)
Q3 is defined by P0,P1,P2,P3
Q4 is defined by P1,P2,P3,P4
Q5 is defined by P2,P3,P4,P5

Each curve segment

shares control points.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Curves
(Two Advantages)
The effect of changing the position of
control point P4 (locality
property).

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Curves

Bzier Curve B-Spline Curve

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

Curves and their


applications in design

B spline curves

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

The B-Spline
Two Major Limitations of the Bezier
Curves
1. Dependence on the number of
defining
polygon vertices
Hence the degree of the basis
function is fixed by
this
To increase or decrease the order
we need to
increase or decrease the no. of
P(u ) (1 polygon
u )3 P0 3vertices
u (1 u ) 2 P1 3u 2 (1 u ) P2 u 3 P3
2. No local control only global
control

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

B-Spline
How it is like the bezier
Approximates control points
Possesses Convex Hull Property
How it differs
Degree of polynomial is for the most
part
independent of the control points
Local control over spline shape
Local contorl acheieved by defining
blending functions
over subintervals of the total range of
t
Stronger Convex Hull Property
More complex than Bezier
Generally non-globa

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Description of B-Spline

n
P (u ) PN
i i ,k (u ),0 u u max
i 0

k=degree
Can be 2 to the number of
control points
If k set to 1, then only a
plot of the control points
Bi is the input set of n+1 control
points
(polygon vertices)
Parameter t now depends on
how we
choose the other parameters (no
longer locked to 0-1)
N i,k blending functions
Polynomials of degree k-1at each
Maharishi Markandeshwar University
interval xi
Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Knots, Knot Vector)
Let U be a set of m + 1 non-decreasing
numbers, u0 <= u2 <= u3 <= ... <= um. The ui's
are called knots,
The set U is the knot vector.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Knots, Knot Vector)
U u , u , u , , u
0 1 2 m

The half-open interval [ui, ui+1) is the i-th knot
span.
Some ui's may be equal, some knot spans may
not exist.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Knots)
U u , u , u , , u
0 1 2 m

If a knot ui appears k times (i.e., ui = ui+1 = ... = ui+k-1), where k >
1, ui is a multiple knot of multiplicity k, written as ui(k).
If ui appears only once, it is a simple knot.
If the knots are equally spaced (i.e., ui+1 - ui is a constant for 0
<= i <= m - 1), the knot vector or the knot sequence is said
uniform; otherwise, it is non-uniform.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions

All B-spline basis functions are supposed


to have their domain on [u0, um].

We use u0 = 0 and um = 1
frequently so that the domain is
the closed interval [0,1].

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions
To define B-spline basis functions, we
need one more parameter.
The degree of these basis functions, p.
The i-th B-spline basis function of
degree p, written as Ni,p(u), is defined
recursively
1 if uas follows:
i u u i 1
N i ,0 (0)
0 otherwise
u ui ui p 1 u
N i , p (u ) N i , p 1 (u ) N i 1, p 1 (u )
ui p ui ui p 1 ui 1
Maharishi Markandeshwar University
Computer Aided Design and Manufacturing
B-Spline Basis Functions
1 if ui u ui 1
N i , 0 ( 0)
0 otherwise
u ui ui p 1 u
N i , p (u ) N i , p 1 (u ) N i 1, p 1 (u )
ui p ui ui p 1 ui 1
The above is usually referred to as the Cox-de Boor recursion formula.
If the degree is zero (i.e., p = 0), these basis functions are all step functions .
basis function Ni,0(u) is 1 if u is in the i-th knot span [ui, ui+1).

We have four knots u0 = 0,


u1 = 1, u2 = 2 and u3 = 3,
knot spans 0, 1 and 2 are
[0,1), [1,2), [2,3) and the
basis functions of degree 0
are N0,0(u) = 1 on [0,1) and
0 elsewhere, N1,0(u) = 1 on
[1,2) and 0 elsewhere, and
Maharishi Markandeshwar University N2,0(u) = 1 on [2,3) and 0
Computer Aided Design and Manufacturing
B-Spline Basis Functions
To understand the way of computing Ni,p(u) for p
greater than 0, we use the triangular computation
scheme.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions
To compute Ni,1(u), Ni,0(u) and Ni+1,0(u) are required. Therefore, we can
compute N0,1(u), N1,1(u), N2,1(u), N3,1(u) and so on. All of these Ni,1(u)'s are
written on the third column. Once all Ni,1(u)'s have been computed, we
can compute Ni,2(u)'s and put them on the fourth column. This process
continues until all required Ni,p(u)'s are computed.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions

Since u0 = 0, u1 = 1 and u2 = 2, the above becomes

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

Two Important
Observation

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Two Important Observation
Basis function Ni,p(u) is non-zero on
[ui, ui+p+1). Or, equivalently, Ni,p(u) is
non-zero on p+1 knot spans [ui, ui+1),
[ui+1, ui+2), ..., [ui+p, ui+p+1).

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
Two Important Observation
On any knot span [ui, ui+1), at most p+1
degree p basis functions are non-zero,
namely: Ni-p,p(u), Ni-p+1,p(u), Ni-p+2,p(u), ..., Ni-
1,p(u) and Ni,p(u),

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

B-Spline Basis Functions


(Important Properties )

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Important Properties )
1 if u i u u i 1
N i , 0 (0)
0 otherwise
u ui u i p 1 u
N i , p (u ) N i , p 1 (u ) N i 1, p 1 (u )
ui p ui u i p 1 ui 1

1. Ni,p(u) is a degree p polynomial in u.

2. Non-negativity -- For all i, p and u, Ni,p(u) is


non-negative

3. Local Support -- Ni,p(u) is a non-zero


polynomial on [ui,ui+p+1)
Maharishi Markandeshwar University
Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Important Properties )
4. On any span [ui, ui+1), at most p+1 degree p
basis functions are non-zero, namely: Ni-p,p(u),
Ni-p+1,p(u), Ni-p+2,p(u), ..., and Ni,p(u) .

5. The sum of all non-zero degree p basis


functions on span [ui, ui+1) is 1.

6. If the number of knots is m+1, the


degree of the basis functions is p, and
the number of degree p basis functions
is n+1, then m = n + p + 1
Maharishi Markandeshwar University
Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Important Properties )
7. Basis function Ni,p(u) is a composite curve of degree
p polynomials with joining points at knots in [ui, ui+p+1
)

8. At a knot of multiplicity k, basis function Ni,p(u) is Cp-k


Increasing
continuous. multiplicity decreases
the level of continuity, and
increasing degree increases
continuity.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Computation Examples)
Simple Knots
Suppose the knot vector is U = { 0, 0.25, 0.5, 0.75, 1 }.
Basis functions of degree 0 : N0,0(u), N1,0(u), N2,0(u) and N3,0(u) defined
on knot span [0,0.25,), [0.25,0.5), [0.5,0.75) and [0.75,1), respectively.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Computation Examples)
All Ni,1(u)'s (U = { 0, 0.25, 0.5, 0.75, 1 }(:

4u for 0 u 0.25
N (u )
2(1 2u ) for 0.25 u 0.5
0 ,1

4u 1 for 0.25 u 0.5


N1,1 (u )
3 u for 0.5 u 0.75
2(2u 1) for 0.5 u 0.75
N 2,1 (u )
4(1 u ) for 0.75 u 1
Since the internal knots 0.25, 0.5 and 0.75 are all simple
(i.e., k = 1) and p = 1, there are p - k + 1 = 1 non-zero
basis function and three knots. Moreover, N0,1(u), N1,1(u)
and N2,1(u) are C0 continuous at knots 0.25, 0.5 and
0.75, respectively.
Maharishi Markandeshwar University
Computer Aided Design and Manufacturing
B-Spline Basis Functions
(Computation Examples)
From Ni,1(u)'s, one can compute the basis functions of
degree 2. Since m = 4, p = 2, and m = n + p + 1, we
have n = 1 and there are only two basis functions of
8u 2
degree 2: N (u) 0 u N0.25(u). (U = { 0, 0.25, 0.5, 0.75,
forand
0,2 1,2
N 0, 2 (u ) 1.5 12u 16u for 0.25 u 0.5
2
1 }(:
4.5 12u 8u for 0.5 u 0.75
2

0.5 4u 8u 2 for 0.25 u 0.5



N1, 2 (u ) 1.5 8u 8u 2 for 0.5 u 0.75
8(1 u ) 2 for 0.75 u 1

each basis function is a composite curve of three
degree 2 curve segments.
C1 continuity
composite curve is of
Maharishi Markandeshwar University
Computer Aided Design and Manufacturing
B-Spline Basis Functions (Computation Examples)
Knots with Positive Multiplicity :
Suppose the knot vector is U = { 0, 0, 0, 0.3, 0.5, 0.5, 0.6, 1, 1, 1{
Since m = 9 and p = 0 (degree 0 basis functions), we have n = m - p -
1 = 8. there are only four non-zero basis functions of degree 0: N2,0(u),
N3,0(u), N5,0(u) and N6,0(u).

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing

B-Spline
Curves

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Curves
(Definition)
Given n + 1 control points P0, P1, ..., Pn and a knot vector U = { u0,

u1, ..., um }, the B-spline curve of degree p defined by these control


points and knot vector U is
n
C(u ) N i , p (u )p i , u 0 u u m p m n 1
i 0

The point on the curve that corresponds to a knot ui, C(ui), is referred
to as aknot point.
The knot points divide a B-spline curve into curve segments, each
of which is defined on a knot span.

Maharishi Markandeshwar University


Computer Aided Design and Manufacturing
B-Spline Curves
(Definition)
n
C(u ) N i , p (u )p i , u 0 u u m p m n 1
i 0
The degree of a B-spline basis function is an
input.
Tochange the shape of a B-spline curve, one can modify
one or more of these control parameters:
1. The positions of control points
2. The positions of knots
3. The degree of the curve

Maharishi Markandeshwar University

You might also like