1
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
Department of Mechanical Engineering
National Institute of Technology Jamshedpur
Deepak Kumar,
Department of Mechanical Engineering, NIT Jamshedpur
deepak.me@nitjsr.ac.in
Computer Aided Design/Computer Aided Manufacturing
2
Types of Spline
 Hermite Cubic Splines
Natural Cubic Splines
Cardinal Splines
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
3
Control Points
How many control points?
 Two points define a line (1st
order)
 Three points define a quadratic curve (2nd
order)
 Four points define a cubic curve (3rd
order)
 k+1points define a k-order curve
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
4
• A spline is a parametric curve defined by
control points
– The term spline , taken from engineering
drawing, where a spline was a piece of flexible
wood used to draw smooth curves
– The control points are adjusted by the user to
control the shape of the curve
Hermite Cubic Spline
*Interpolation is the process of defining a function that “connects the dots”
between specified (data) points.
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
5
• A Hermite spline is a curve for which the
user provides:
– The endpoints of the curve
– The parametric derivatives of the curve at the
endpoints (tangents with length)
• The parametric derivatives are dx/du, dy/du, dz/du
– That is enough to define a cubic Hermite
spline
Hermite Cubic Spline
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
6
Hermite Cubic Spline
The parametric equation of a cubic spline segment is given by
3
0
( ) ,0 1
i
i
i
P u C u u

  

Where u is the parameter and Ci are the polynomial (also called as
algebraic ) co-efficients. In scalar form, this equation is written as,
3 2
3 2 1 0
( ) x x x x
x u C u C u C u C
   
3 2
3 2 1 0
( ) y y y y
y u C u C u C u C
   
3 2
3 2 1 0
( ) z z z z
z u C u C u C u C
   
(1)
(2)
In the expanded vector form, Eq. (1) can be written as,
3 2
3 2 1 0
( )
P u C u C u C u C
   
(3)
*A cubic spline has degree 3.
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
7
Equation can also be written as in matrix form as,
Hermite Cubic Spline
( ) T
P u U C

3 2
1
T
U u u u
 
 
where,
and  
3 2 1 0
T
C C C C C

C is called the co-efficients vector
Tangent vector to the curve at any point is given by differentiating
Eq. (1), with respect to u give
3
' 1
0
( ) ,0 1
i
i
i
P u C iu u


  
 (5)
(4)
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
8
Hermite Cubic Spline
Applying boundary conditions ( , at u=0 and , at u=1)
0
P '
0
P 1
P '
1
P
Eq. (1) and (2) give
0 0
P C

'
0 1
P C

1 3 2 1 0
P C C C C
   
1
'
3 2 1
3 2
P C C C
  
Solving these four equations simultaneously for the co-efficients gives
0 0
C P

'
1 0
C P

' '
2 1 0 0 1
3( ) 2
C P P P P
   
' '
3 0 1 0 1
2( )
C P P P P
   
(6)
(7)
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
9
Substituting Eq. (6) into Eq. (3),
3 2 3 2 3 2 ' 3 2 '
0 1 0 1
( ) (2 3 1) ( 2 3 ) ( 2 ) ( )
P u u u P u u P u u u P u u P
          
0 1
u
  (8)
The tangent vector becomes,
, , and are called geometric co-efficients.
0
P 1
P '
0
P '
1
P
' 2 2 2 ' 2 '
0 1 0 1
( ) (6 6 ) ( 6 6 ) (3 4 1) (3 2 )
P u u u P u u P u u P u u P
         
0 1
u
  (9)
The function of u in Eq. (1) and (2) are called blending functions.
Equation (8) can be written as in matrix form,
 
( ) ,
T
H
P u U M V
 0 1
u
 
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
10
Where [MH] is the Hermite matrix and V is the geometry vector. Both are
given by
 
2 2 1 1
3 3 2 1
0 0 1 0
1 0 0 0
H
M

 
 
  
 

 
 
 
' '
0 1 0 1
T
V P P P P
 
 
Comparing Eq. 4 and 9 show that C=[MH]V or
 
1
H
V M C


where
 
1
0 0 0 1
1 1 1 1
0 0 1 0
3 2 1 0
H
M

 
 
 

 
 
 
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
11
Eq. 8 can be written as
 
'
( )
u
T
H
P u U M V

where is given by
 
u
H
M
 
0 0 0 0
6 6 3 3
6 6 4 2
0 0 1 0
u
H
M
 
 

 

 
  
 
 
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
12
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
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
13
Control Point Interpretation
Point along start tangent
End Point
Point along end Tangent
Start Point
2
x
0
x 2
x
3
x
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
14
Bezier Curves of Varying Degree
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
15
Bézier Curves
Bézier 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.
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
16
Bézier Curves
• In general, a Bézier 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 Bézier polynomial.
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
17
• Coordinate points can be blended to produced the following position vector
P(u), which describes the path of an approximating Bézier polynomial function
between P0 and Pn.
,
0
( ) ( ),0 1
n
i i n
i
P u PB u u

  

Where P(u) is any point on the curve and Pi is a control point. Bi,n are the Bernstein
Polynomials. Thus, the Bezier curve has a Bernstein basis. The Bernstein polynomial
Serves as the blending or basis function for the Bezier curve and given by
, ( ) ( , ) (1 )
i n i
i n
B u C n i u u 
 
Where C (n,i) is the binomial coefficient
!
( , )
!( )!
n
C n i
i n i


(10)
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
18
1 2 2 1
0 1 2 1
( ) (1 ) ( ,1) (1 ) ( ,2) (1 ) .... ( , 1) (1 ) ,0 1
n n n n n
n n
P u P u PC n u u PC n u u P C n n u u P u u
  

            
Expanding Eq (10) and utilizing C(n,0)=C(n,n)
3
0,3( ) (1 )
B u u
 
2
1,3( ) 3 (1 )
B u u u
 
2
2,3( ) 3 (1 )
B u u u
 
3
3,3( )
B u u

0 0,3 1 1,3 2 2,3 3 3,3
( ) ( ) ( ) ( ) ( )
P u P B u PB u P B u P B u
   
3 2 2 3
0 1 2 3
( ) (1 ) 3 (1 ) 3 (1 )
P u u P u u P u u P u P
      
,
0
( ) ( ),0 1
n
i i n
i
P u PB u u

  
 (10)
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
19
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.
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
20
- 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.
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
21
% 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)
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
22
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]);
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
23
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]);
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
24
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
0, 1, 1, ,
[ ] [ , ,..... , ]
n n n n n n
F B B B B


3 2 2 3
0 1 2 3
[ ][ ] (1 ) 3 (1 ) 3 (1 ) [ ]T
F G u u u u u u P P P P
 
   
 
0
1
3 2
2
3
1 3 3 1
3 6 3 0
( ) [ ][ ] [ ][ ][ ] 1
3 3 0 0
1 0 0 0
P
P
P u F G U N G u u u
P
P
   
 
 
 
  
 
 
     
 

 
 
   
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
25
Matrix formulation of Bezier Curve
We can extend this now to a quadratic, for n=4,
Bezier curve
( ) [ ][ ] [ ][ ][ ]
P u F G U N G
 
0
1
4 3 2
2
3
4
1 4 6 4 1
4 12 12 4 0
( ) [ ][ ] [ ][ ][ ] 1 6 12 6 0 0
4 4 0 0 0
1 0 0 0 0
P
P
P
P u F G U N G u u u u
P
P
   
 
 
 
   
 
 
   
   
 
 
 
  
 
 
 
   
National Institute of Technology Jamshedpur
Department of Mechanical Engineering
26
B-Spline Basis: Motivation
Consider designing the profile of a vase.
• The left figure below is a Bézier curve of degree 11; but, it is difficult to bend the "neck" toward the line segment
P4P5.
• The middle figure below uses this idea. It has three Bézier curve segments of degree 3 with joining points
marked with yellow rectangles.
• The right figure below is a B-spline curve of degree 3 defined by 8 control points .
27
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 Bézier
curves.
• We can also modify the subdivision of the curve. Therefore, B-spline curves have higher degree of
freedom for curve design.
28
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.
29
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.
30
B-Spline Basis: Motivation
• The computation of the coefficients is perhaps the most complex
step because they must ensure certain continuity conditions.
31
B-Spline Curves
32
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)
33
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.
34
B-Spline Curves
(Two Advantages)
 The effect of changing the position of
control point P4 (locality property).
35
B-Spline Curves
Bézier Curve B-Spline Curve
36
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 polygon vertices
2. No local control – only global control
3 2 2 3
0 1 2 3
( ) (1 ) 3 (1 ) 3 (1 )
P u u P u u P u u P u P
      
37
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 control achieved by defining blending functions
over subintervals of the total range
– Stronger Convex Hull Property
• More complex than Bezier
• Generally non-globa
38
Description of B-Spline
– 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 interval x
, max
0
( ) ( ),0
n
i i k
i
P u PN u u u

  

39
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.
40
B-Spline Basis Functions
(Knots, Knot Vector)
 
m
u
u
u
u
U ,
,
,
, 2
1
0


• 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.
41
B-Spline Basis Functions
(Knots)
 
m
u
u
u
u
U ,
,
,
, 2
1
0


• 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.
42
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].
43
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 as
follows:
)
(
)
(
)
(
otherwise
0
if
1
)
0
(
1
,
1
1
1
1
1
,
,
1
0
,
u
N
u
u
u
u
u
N
u
u
u
u
u
N
u
u
u
N
p
i
i
p
i
p
i
p
i
i
p
i
i
p
i
i
i
i


















 


44
B-Spline Basis Functions
)
(
)
(
)
(
otherwise
0
if
1
)
0
(
1
,
1
1
1
1
1
,
,
1
0
,
u
N
u
u
u
u
u
N
u
u
u
u
u
N
u
u
u
N
p
i
i
p
i
p
i
p
i
i
p
i
i
p
i
i
i
i


















 


 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
N2,0(u) = 1 on [2,3) and 0
elsewhere.
45
B-Spline Basis Functions
 To understand the way of computing Ni,p(u) for p greater than
0, we use the triangular computation scheme.
46
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.
47
B-Spline Basis Functions
 Since u0 = 0, u1 = 1 and u2 = 2, the above becomes
48
Two Important
Observation
49
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).
50
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),
51
B-Spline Basis Functions
(Important Properties )
52
B-Spline Basis Functions
(Important Properties )
)
(
)
(
)
(
otherwise
0
if
1
)
0
(
1
,
1
1
1
1
1
,
,
1
0
,
u
N
u
u
u
u
u
N
u
u
u
u
u
N
u
u
u
N
p
i
i
p
i
p
i
p
i
i
p
i
i
p
i
i
i
i


















 


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)
53
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
54
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
continuous.
Increasing multiplicity decreases the
level of continuity, and increasing
degree increases continuity.
55
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.
56
B-Spline Basis Functions
(Computation Examples)
All Ni,1(u)'s (U = { 0, 0.25, 0.5, 0.75, 1 }(:









5
.
0
25
.
0
)
2
1
(
2
25
.
0
0
4
)
(
1
,
0
u
u
u
u
u
N
for
for










75
.
0
5
.
0
for
3
5
.
0
25
.
0
for
1
4
)
(
1
,
1
u
u
u
u
u
N










1
75
.
0
for
)
1
(
4
75
.
0
5
.
0
for
)
1
2
(
2
)
(
1
,
2
u
u
u
u
u
N
 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.
57
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 degree 2:
N0,2(u) and N1,2(u). (U = { 0, 0.25, 0.5, 0.75, 1 }(:

















75
.
0
5
.
0
for
8
12
5
.
4
5
.
0
25
.
0
for
16
12
5
.
1
25
.
0
0
for
8
)
(
2
2
2
2
,
0
u
u
u
u
u
u
u
u
u
N


















1
75
.
0
for
)
1
(
8
75
.
0
5
.
0
for
8
8
5
.
1
5
.
0
25
.
0
for
8
4
5
.
0
)
(
2
2
2
2
,
1
u
u
u
u
u
u
u
u
u
N
 each basis function is a composite curve of three degree 2
curve segments.
 composite curve is of C1
continuity
58
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).
59
B-Spline Basis Functions
(Computation Examples)
 Basis functions of degree 1: Since p is 1, n = m - p - 1 = 7.
The following table shows the result
Basis Function Range Equation
N0,1(u) all u 0
N1,1(u) [0, 0.3) 1 - (10/3)u
N2,1(u)
[0, 0.3) (10/3)u
[0.3, 0.5) 2.5(1 - 2u)
N3,1(u) [0.3, 0.5) 5u - 1.5
N4,1(u) [0.5, 0.6) 6 - 10u
N5,1(u)
[0.5, 0.6) 10u - 5
[0.6, 1) 2.5(1 - u)
N6,1(u) [0.6, 1) 2.5u - 1.5
N all u 0
60
B-Spline Basis Functions
(Computation Examples)
 Basis functions of degree 1:
61
B-Spline Basis Functions
(Computation Examples)
 Since p = 2, we have n = m - p - 1 = 6. The following table
contains all Ni,2(u)'s:
Function Range Equation
N0,2
(u) [0, 0.3) (1 - (10/3)u)2
N1,2
(u)
[0, 0.3) (20/3)(u - (8/3)u2
)
[0.3, 0.5) 2.5(1 - 2u)2
N2,2
(u)
[0, 0.3) (20/3)u2
[0.3, 0.5) -3.75 + 25u - 35u2
N3,2
(u)
[0.3, 0.5) (5u - 1.5)2
[0.5, 0.6) (6 - 10u)2
N4,2
(u)
[0.5, 0.6) 20(-2 + 7u - 6u2
)
[0.6, 1) 5(1 - u)2
N5,2
(u)
[0.5, 0.6) 12.5(2u - 1)2
[0.6, 1) 2.5(-4 + 11.5u - 7.5u2
)
62
B-Spline Basis Functions
(Computation Examples)
 Basis functions of degree 2:
 Since its multiplicity is 2 and the degree of these basis functions is
2, basis function N3,2(u) is C0
continuous at 0.5(2). This is why
N3,2(u) has a sharp angle at 0.5(2).
 For knots not at the two ends, say 0.3 and 0.6, C1
continuity is
maintained since all of them are simple knots.
U = { 0, 0, 0, 0.3, 0.5, 0.5, 0.6, 1, 1, 1{
63
B-Spline
Curves
64
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
1
,
)
(
)
( 0
0
, 






n
m
p
u
u
u
u
N
u m
n
i
i
p
i p
C
 The point on the curve that corresponds to a knot ui, C(ui), is referred to
as a knot point.
 The knot points divide a B-spline curve into curve segments, each of
which is defined on a knot span.
65
B-Spline Curves
(Definition)
1
,
)
(
)
( 0
0
, 






n
m
p
u
u
u
u
N
u m
n
i
i
p
i p
C
 The degree of a B-spline basis function is an input.
 To change 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
66
(Open, Clamped & Closed B-Spline Curves)
 Open B-spline curves: If the knot vector does not have any particular
structure, the generated curve will not touch the first and last legs of the
control polyline.
 Clamped B-spline curve: If the first knot and the last knot multiplicity
p+1, curve is tangent to the first and the last legs at the first and last
control polyline, as a Bézier curve does.
 Closed B-spline curves: By repeating some knots and control points, the
generated curve can be a closed one. In this case, the start and the end of
the generated curve join together forming a closed loop.
Open B-Spline Clamped B-
Spline
Closed B-
Spline
67
Open
B-Spline Curves
68
Open B-Spline Curves
 Recall from the B-spline basis function
property that on a knot span [ui, ui+1), there
are at most p+1 non-zero basis functions of
degree p.
For open B-spline curves, the
domain is [up, um-p].
69
Open B-Spline Curves
Example 1:
 knot vector U = { 0, 0.25, 0.5, 0.75, 1 }, where m = 4. If the
basis functions are of degree 1 (i.e., p = 1), there are three
basis functions N0,1(u), N1,1(u) and N2,1(u).
 Since this knot vector is not clamped, the first and the last
knot spans (i.e., [0, 0.25) and [0.75, 1)) have only one non-
zero basis functions while the second and third knot spans
(i.e., [0.25, 0.5) and [0.5, 0.75)) have two non-zero basis
functions.
70
Open B-Spline Curves
Example 2:
71
Open B-Spline Curves
Example 3:
 A B-spline curve of degree 6 (i.e., p = 6) defined by 14
control points (i.e., n = 13). The number of knots is 21 (i.e., m
= n + p + 1 = 20).
 If the knot vector is uniform, the knot vector is }0, 0.05, 0.10,
0.15, ..., 0.90, 0.95,10{. The open curve is defined on [up, um-
p] = [u6, u14] = [0.3, 0.7] and is not tangent to the first and last
legs.
72
Clamped
B-Spline Curves
73
Closed B-Spline Curves
 To construct a closed B-spline curve P(u) of degree p defined
by n+1 control points ,the number of knots is m+1, We must:
1. Design an uniform knot sequence of m+1 knots: u0 = 0, u1 =
1/m, u2 = 2/m, ..., um = 1. Note that the domain of the curve is [up, un-p].
2. Wrap the first p and last p control points. More precisely, let
P0 = Pn-p+1, P1 = Pn-p+2, ..., Pp-2 = Pn-1 and Pp-1 = Pn.
74
Closed B-Spline Curves
 Example. Figure (a) shows an open B-spline curve of degree
3 defined by 10 (n = 9) control points and a uniform knot
vector.
 In the figure, control point pairs 0 and 7, Figure (b), 1 and 8,
Figure (c), and 2 and 9, Figure (d) are placed close to each
other to illustrate the construction.
a
75
Closed B-Spline Curves
a b
76
B-Spline Curves
Important Properties
77
B-Spline Curves Important Properties
1. B-spline curve C(u) is a piecewise curve with each
component a curve of degree p.
 ٍExample: where n = 10, m = 14 and p = 3, the first four knots
and last four knots are clamped and the 7 internal knots are
uniformly spaced. There are 8 knot spans, each of which
corresponds to a curve segment.
Clamped B-Spline Curve Bézier Curve (degree 10!)
78
B-Spline Curves Important Properties
2. Equality m = n + p + 1 must be satisfied.
3. Clamped B-spline curve C(u) passes through the
two end control points P0 and Pn.
4. Strong Convex Hull Property: A B-spline curve
is contained in the convex hull of its control
polyline.
79
B-Spline Curves Important Properties
5. Local Modification Scheme: changing the position of
control point Pi only affects the curve C(u) on interval
[ui, ui+p+1).
 The right figure shows the result of moving P2 to the lower right corner. Only
the first, second and third curve segments change their shapes and all remaining
curve segments stay in their original place without any change.
80
B-Spline Curves Important Properties
 A B-spline curve of degree 4 defined by 13 control points and 18 knots .
 Move P6.
 The coefficient of P6 is N6,4(u), which is non-zero on [u6, u11). Thus, moving
P6 affects curve segments 3, 4, 5, 6 and 7. Curve segments 1, 2, 8 and 9 are
not affected.

CAD_spline curves, hermite, cubic and cardinal

  • 1.
    1 National Institute ofTechnology Jamshedpur Department of Mechanical Engineering Department of Mechanical Engineering National Institute of Technology Jamshedpur Deepak Kumar, Department of Mechanical Engineering, NIT Jamshedpur deepak.me@nitjsr.ac.in Computer Aided Design/Computer Aided Manufacturing
  • 2.
    2 Types of Spline Hermite Cubic Splines Natural Cubic Splines Cardinal Splines National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 3.
    3 Control Points How manycontrol points?  Two points define a line (1st order)  Three points define a quadratic curve (2nd order)  Four points define a cubic curve (3rd order)  k+1points define a k-order curve National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 4.
    4 • A splineis a parametric curve defined by control points – The term spline , taken from engineering drawing, where a spline was a piece of flexible wood used to draw smooth curves – The control points are adjusted by the user to control the shape of the curve Hermite Cubic Spline *Interpolation is the process of defining a function that “connects the dots” between specified (data) points. National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 5.
    5 • A Hermitespline is a curve for which the user provides: – The endpoints of the curve – The parametric derivatives of the curve at the endpoints (tangents with length) • The parametric derivatives are dx/du, dy/du, dz/du – That is enough to define a cubic Hermite spline Hermite Cubic Spline National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 6.
    6 Hermite Cubic Spline Theparametric equation of a cubic spline segment is given by 3 0 ( ) ,0 1 i i i P u C u u      Where u is the parameter and Ci are the polynomial (also called as algebraic ) co-efficients. In scalar form, this equation is written as, 3 2 3 2 1 0 ( ) x x x x x u C u C u C u C     3 2 3 2 1 0 ( ) y y y y y u C u C u C u C     3 2 3 2 1 0 ( ) z z z z z u C u C u C u C     (1) (2) In the expanded vector form, Eq. (1) can be written as, 3 2 3 2 1 0 ( ) P u C u C u C u C     (3) *A cubic spline has degree 3. National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 7.
    7 Equation can alsobe written as in matrix form as, Hermite Cubic Spline ( ) T P u U C  3 2 1 T U u u u     where, and   3 2 1 0 T C C C C C  C is called the co-efficients vector Tangent vector to the curve at any point is given by differentiating Eq. (1), with respect to u give 3 ' 1 0 ( ) ,0 1 i i i P u C iu u       (5) (4) National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 8.
    8 Hermite Cubic Spline Applyingboundary conditions ( , at u=0 and , at u=1) 0 P ' 0 P 1 P ' 1 P Eq. (1) and (2) give 0 0 P C  ' 0 1 P C  1 3 2 1 0 P C C C C     1 ' 3 2 1 3 2 P C C C    Solving these four equations simultaneously for the co-efficients gives 0 0 C P  ' 1 0 C P  ' ' 2 1 0 0 1 3( ) 2 C P P P P     ' ' 3 0 1 0 1 2( ) C P P P P     (6) (7) National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 9.
    9 Substituting Eq. (6)into Eq. (3), 3 2 3 2 3 2 ' 3 2 ' 0 1 0 1 ( ) (2 3 1) ( 2 3 ) ( 2 ) ( ) P u u u P u u P u u u P u u P            0 1 u   (8) The tangent vector becomes, , , and are called geometric co-efficients. 0 P 1 P ' 0 P ' 1 P ' 2 2 2 ' 2 ' 0 1 0 1 ( ) (6 6 ) ( 6 6 ) (3 4 1) (3 2 ) P u u u P u u P u u P u u P           0 1 u   (9) The function of u in Eq. (1) and (2) are called blending functions. Equation (8) can be written as in matrix form,   ( ) , T H P u U M V  0 1 u   National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 10.
    10 Where [MH] isthe Hermite matrix and V is the geometry vector. Both are given by   2 2 1 1 3 3 2 1 0 0 1 0 1 0 0 0 H M                  ' ' 0 1 0 1 T V P P P P     Comparing Eq. 4 and 9 show that C=[MH]V or   1 H V M C   where   1 0 0 0 1 1 1 1 1 0 0 1 0 3 2 1 0 H M               National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 11.
    11 Eq. 8 canbe written as   ' ( ) u T H P u U M V  where is given by   u H M   0 0 0 0 6 6 3 3 6 6 4 2 0 0 1 0 u H M                  National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 12.
    12 Bezier Curves • Differentchoices 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 National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 13.
    13 Control Point Interpretation Pointalong start tangent End Point Point along end Tangent Start Point 2 x 0 x 2 x 3 x National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 14.
    14 Bezier Curves ofVarying Degree National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 15.
    15 Bézier Curves Bézier splinesare:  spline approximation method;  useful and convenient for curve and surface design;  easy to implement;  available in CAD system, graphic package, drawing and painting packages. National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 16.
    16 Bézier Curves • Ingeneral, a Bézier 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 Bézier polynomial. National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 17.
    17 • Coordinate pointscan be blended to produced the following position vector P(u), which describes the path of an approximating Bézier polynomial function between P0 and Pn. , 0 ( ) ( ),0 1 n i i n i P u PB u u      Where P(u) is any point on the curve and Pi is a control point. Bi,n are the Bernstein Polynomials. Thus, the Bezier curve has a Bernstein basis. The Bernstein polynomial Serves as the blending or basis function for the Bezier curve and given by , ( ) ( , ) (1 ) i n i i n B u C n i u u    Where C (n,i) is the binomial coefficient ! ( , ) !( )! n C n i i n i   (10) National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 18.
    18 1 2 21 0 1 2 1 ( ) (1 ) ( ,1) (1 ) ( ,2) (1 ) .... ( , 1) (1 ) ,0 1 n n n n n n n P u P u PC n u u PC n u u P C n n u u P u u                  Expanding Eq (10) and utilizing C(n,0)=C(n,n) 3 0,3( ) (1 ) B u u   2 1,3( ) 3 (1 ) B u u u   2 2,3( ) 3 (1 ) B u u u   3 3,3( ) B u u  0 0,3 1 1,3 2 2,3 3 3,3 ( ) ( ) ( ) ( ) ( ) P u P B u PB u P B u P B u     3 2 2 3 0 1 2 3 ( ) (1 ) 3 (1 ) 3 (1 ) P u u P u u P u u P u P        , 0 ( ) ( ),0 1 n i i n i P u PB u u      (10) National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 19.
    19 The vertices ofthe 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. National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 20.
    20 - The curvegenerally 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. National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 21.
    21 % Bezier curvefor 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) National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 22.
    22 Example % Bezier curvefor 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]); National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 23.
    23 Example % Bezier curvefor 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]); National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 24.
    24 Matrix formulation ofBezier Curve Consider a cubic Bezier curve ( ) [ ][ ] [ ][ ][ ] P u F G U N G   Where [F] is the blending matrix given by 0, 1, 1, , [ ] [ , ,..... , ] n n n n n n F B B B B   3 2 2 3 0 1 2 3 [ ][ ] (1 ) 3 (1 ) 3 (1 ) [ ]T F G u u u u u u P P P P         0 1 3 2 2 3 1 3 3 1 3 6 3 0 ( ) [ ][ ] [ ][ ][ ] 1 3 3 0 0 1 0 0 0 P P P u F G U N G u u u P P                                   National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 25.
    25 Matrix formulation ofBezier Curve We can extend this now to a quadratic, for n=4, Bezier curve ( ) [ ][ ] [ ][ ][ ] P u F G U N G   0 1 4 3 2 2 3 4 1 4 6 4 1 4 12 12 4 0 ( ) [ ][ ] [ ][ ][ ] 1 6 12 6 0 0 4 4 0 0 0 1 0 0 0 0 P P P P u F G U N G u u u u P P                                              National Institute of Technology Jamshedpur Department of Mechanical Engineering
  • 26.
    26 B-Spline Basis: Motivation Considerdesigning the profile of a vase. • The left figure below is a Bézier curve of degree 11; but, it is difficult to bend the "neck" toward the line segment P4P5. • The middle figure below uses this idea. It has three Bézier curve segments of degree 3 with joining points marked with yellow rectangles. • The right figure below is a B-spline curve of degree 3 defined by 8 control points .
  • 27.
    27 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 Bézier curves. • We can also modify the subdivision of the curve. Therefore, B-spline curves have higher degree of freedom for curve design.
  • 28.
    28 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.
  • 29.
    29 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.
  • 30.
    30 B-Spline Basis: Motivation •The computation of the coefficients is perhaps the most complex step because they must ensure certain continuity conditions.
  • 31.
  • 32.
    32 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)
  • 33.
    33 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.
  • 34.
    34 B-Spline Curves (Two Advantages) The effect of changing the position of control point P4 (locality property).
  • 35.
  • 36.
    36 Two Major Limitationsof 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 polygon vertices 2. No local control – only global control 3 2 2 3 0 1 2 3 ( ) (1 ) 3 (1 ) 3 (1 ) P u u P u u P u u P u P       
  • 37.
    37 B-Spline • How itis 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 control achieved by defining blending functions over subintervals of the total range – Stronger Convex Hull Property • More complex than Bezier • Generally non-globa
  • 38.
    38 Description of B-Spline –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 interval x , max 0 ( ) ( ),0 n i i k i P u PN u u u     
  • 39.
    39 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.
  • 40.
    40 B-Spline Basis Functions (Knots,Knot Vector)   m u u u u U , , , , 2 1 0   • 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.
  • 41.
    41 B-Spline Basis Functions (Knots)  m u u u u U , , , , 2 1 0   • 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.
  • 42.
    42 B-Spline Basis Functions AllB-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].
  • 43.
    43 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 as follows: ) ( ) ( ) ( otherwise 0 if 1 ) 0 ( 1 , 1 1 1 1 1 , , 1 0 , u N u u u u u N u u u u u N u u u N p i i p i p i p i i p i i p i i i i                      
  • 44.
    44 B-Spline Basis Functions ) ( ) ( ) ( otherwise 0 if 1 ) 0 ( 1 , 1 1 1 1 1 , , 1 0 , u N u u u u u N u u u u u N u u u N p i i p i p i p i i p i i p i i i i                       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 N2,0(u) = 1 on [2,3) and 0 elsewhere.
  • 45.
    45 B-Spline Basis Functions To understand the way of computing Ni,p(u) for p greater than 0, we use the triangular computation scheme.
  • 46.
    46 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.
  • 47.
    47 B-Spline Basis Functions Since u0 = 0, u1 = 1 and u2 = 2, the above becomes
  • 48.
  • 49.
    49 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).
  • 50.
    50 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),
  • 51.
  • 52.
    52 B-Spline Basis Functions (ImportantProperties ) ) ( ) ( ) ( otherwise 0 if 1 ) 0 ( 1 , 1 1 1 1 1 , , 1 0 , u N u u u u u N u u u u u N u u u N p i i p i p i p i i p i i p i i i i                       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)
  • 53.
    53 B-Spline Basis Functions (ImportantProperties ) 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
  • 54.
    54 B-Spline Basis Functions (ImportantProperties ) 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 continuous. Increasing multiplicity decreases the level of continuity, and increasing degree increases continuity.
  • 55.
    55 B-Spline Basis Functions (ComputationExamples) 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.
  • 56.
    56 B-Spline Basis Functions (ComputationExamples) All Ni,1(u)'s (U = { 0, 0.25, 0.5, 0.75, 1 }(:          5 . 0 25 . 0 ) 2 1 ( 2 25 . 0 0 4 ) ( 1 , 0 u u u u u N for for           75 . 0 5 . 0 for 3 5 . 0 25 . 0 for 1 4 ) ( 1 , 1 u u u u u N           1 75 . 0 for ) 1 ( 4 75 . 0 5 . 0 for ) 1 2 ( 2 ) ( 1 , 2 u u u u u N  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.
  • 57.
    57 B-Spline Basis Functions (ComputationExamples)  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 degree 2: N0,2(u) and N1,2(u). (U = { 0, 0.25, 0.5, 0.75, 1 }(:                  75 . 0 5 . 0 for 8 12 5 . 4 5 . 0 25 . 0 for 16 12 5 . 1 25 . 0 0 for 8 ) ( 2 2 2 2 , 0 u u u u u u u u u N                   1 75 . 0 for ) 1 ( 8 75 . 0 5 . 0 for 8 8 5 . 1 5 . 0 25 . 0 for 8 4 5 . 0 ) ( 2 2 2 2 , 1 u u u u u u u u u N  each basis function is a composite curve of three degree 2 curve segments.  composite curve is of C1 continuity
  • 58.
    58 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).
  • 59.
    59 B-Spline Basis Functions (ComputationExamples)  Basis functions of degree 1: Since p is 1, n = m - p - 1 = 7. The following table shows the result Basis Function Range Equation N0,1(u) all u 0 N1,1(u) [0, 0.3) 1 - (10/3)u N2,1(u) [0, 0.3) (10/3)u [0.3, 0.5) 2.5(1 - 2u) N3,1(u) [0.3, 0.5) 5u - 1.5 N4,1(u) [0.5, 0.6) 6 - 10u N5,1(u) [0.5, 0.6) 10u - 5 [0.6, 1) 2.5(1 - u) N6,1(u) [0.6, 1) 2.5u - 1.5 N all u 0
  • 60.
    60 B-Spline Basis Functions (ComputationExamples)  Basis functions of degree 1:
  • 61.
    61 B-Spline Basis Functions (ComputationExamples)  Since p = 2, we have n = m - p - 1 = 6. The following table contains all Ni,2(u)'s: Function Range Equation N0,2 (u) [0, 0.3) (1 - (10/3)u)2 N1,2 (u) [0, 0.3) (20/3)(u - (8/3)u2 ) [0.3, 0.5) 2.5(1 - 2u)2 N2,2 (u) [0, 0.3) (20/3)u2 [0.3, 0.5) -3.75 + 25u - 35u2 N3,2 (u) [0.3, 0.5) (5u - 1.5)2 [0.5, 0.6) (6 - 10u)2 N4,2 (u) [0.5, 0.6) 20(-2 + 7u - 6u2 ) [0.6, 1) 5(1 - u)2 N5,2 (u) [0.5, 0.6) 12.5(2u - 1)2 [0.6, 1) 2.5(-4 + 11.5u - 7.5u2 )
  • 62.
    62 B-Spline Basis Functions (ComputationExamples)  Basis functions of degree 2:  Since its multiplicity is 2 and the degree of these basis functions is 2, basis function N3,2(u) is C0 continuous at 0.5(2). This is why N3,2(u) has a sharp angle at 0.5(2).  For knots not at the two ends, say 0.3 and 0.6, C1 continuity is maintained since all of them are simple knots. U = { 0, 0, 0, 0.3, 0.5, 0.5, 0.6, 1, 1, 1{
  • 63.
  • 64.
    64 B-Spline Curves (Definition)  Givenn + 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 1 , ) ( ) ( 0 0 ,        n m p u u u u N u m n i i p i p C  The point on the curve that corresponds to a knot ui, C(ui), is referred to as a knot point.  The knot points divide a B-spline curve into curve segments, each of which is defined on a knot span.
  • 65.
    65 B-Spline Curves (Definition) 1 , ) ( ) ( 0 0 ,       n m p u u u u N u m n i i p i p C  The degree of a B-spline basis function is an input.  To change 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
  • 66.
    66 (Open, Clamped &Closed B-Spline Curves)  Open B-spline curves: If the knot vector does not have any particular structure, the generated curve will not touch the first and last legs of the control polyline.  Clamped B-spline curve: If the first knot and the last knot multiplicity p+1, curve is tangent to the first and the last legs at the first and last control polyline, as a Bézier curve does.  Closed B-spline curves: By repeating some knots and control points, the generated curve can be a closed one. In this case, the start and the end of the generated curve join together forming a closed loop. Open B-Spline Clamped B- Spline Closed B- Spline
  • 67.
  • 68.
    68 Open B-Spline Curves Recall from the B-spline basis function property that on a knot span [ui, ui+1), there are at most p+1 non-zero basis functions of degree p. For open B-spline curves, the domain is [up, um-p].
  • 69.
    69 Open B-Spline Curves Example1:  knot vector U = { 0, 0.25, 0.5, 0.75, 1 }, where m = 4. If the basis functions are of degree 1 (i.e., p = 1), there are three basis functions N0,1(u), N1,1(u) and N2,1(u).  Since this knot vector is not clamped, the first and the last knot spans (i.e., [0, 0.25) and [0.75, 1)) have only one non- zero basis functions while the second and third knot spans (i.e., [0.25, 0.5) and [0.5, 0.75)) have two non-zero basis functions.
  • 70.
  • 71.
    71 Open B-Spline Curves Example3:  A B-spline curve of degree 6 (i.e., p = 6) defined by 14 control points (i.e., n = 13). The number of knots is 21 (i.e., m = n + p + 1 = 20).  If the knot vector is uniform, the knot vector is }0, 0.05, 0.10, 0.15, ..., 0.90, 0.95,10{. The open curve is defined on [up, um- p] = [u6, u14] = [0.3, 0.7] and is not tangent to the first and last legs.
  • 72.
  • 73.
    73 Closed B-Spline Curves To construct a closed B-spline curve P(u) of degree p defined by n+1 control points ,the number of knots is m+1, We must: 1. Design an uniform knot sequence of m+1 knots: u0 = 0, u1 = 1/m, u2 = 2/m, ..., um = 1. Note that the domain of the curve is [up, un-p]. 2. Wrap the first p and last p control points. More precisely, let P0 = Pn-p+1, P1 = Pn-p+2, ..., Pp-2 = Pn-1 and Pp-1 = Pn.
  • 74.
    74 Closed B-Spline Curves Example. Figure (a) shows an open B-spline curve of degree 3 defined by 10 (n = 9) control points and a uniform knot vector.  In the figure, control point pairs 0 and 7, Figure (b), 1 and 8, Figure (c), and 2 and 9, Figure (d) are placed close to each other to illustrate the construction. a
  • 75.
  • 76.
  • 77.
    77 B-Spline Curves ImportantProperties 1. B-spline curve C(u) is a piecewise curve with each component a curve of degree p.  ٍExample: where n = 10, m = 14 and p = 3, the first four knots and last four knots are clamped and the 7 internal knots are uniformly spaced. There are 8 knot spans, each of which corresponds to a curve segment. Clamped B-Spline Curve Bézier Curve (degree 10!)
  • 78.
    78 B-Spline Curves ImportantProperties 2. Equality m = n + p + 1 must be satisfied. 3. Clamped B-spline curve C(u) passes through the two end control points P0 and Pn. 4. Strong Convex Hull Property: A B-spline curve is contained in the convex hull of its control polyline.
  • 79.
    79 B-Spline Curves ImportantProperties 5. Local Modification Scheme: changing the position of control point Pi only affects the curve C(u) on interval [ui, ui+p+1).  The right figure shows the result of moving P2 to the lower right corner. Only the first, second and third curve segments change their shapes and all remaining curve segments stay in their original place without any change.
  • 80.
    80 B-Spline Curves ImportantProperties  A B-spline curve of degree 4 defined by 13 control points and 18 knots .  Move P6.  The coefficient of P6 is N6,4(u), which is non-zero on [u6, u11). Thus, moving P6 affects curve segments 3, 4, 5, 6 and 7. Curve segments 1, 2, 8 and 9 are not affected.