curve modelling-b spline
TRANSCRIPT
-
8/11/2019 Curve Modelling-B Spline
1/60
Curve Modeling
B-Spline Curves
Dr. S.M. MalaekAssistant: M. Younesi
-
8/11/2019 Curve Modelling-B Spline
2/60
Motivation
-
8/11/2019 Curve Modelling-B Spline
3/60
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 curvesegments of degree 3 with joining points marked with yellow rectangles.
The right figure above is a B-spline curveof degree 3defined by 8
control points .
B-Spline Basis: Motivation
-
8/11/2019 Curve Modelling-B Spline
4/60
Those little dotssubdividethe B-spline curve into curve
segments.
One can move control pointsfor modifying the shape of thecurve just like what we do to Bzier curves.
We can also modifythe subdivision of the curve. Therefore,
B-spline curves have higher degree of freedomfor curve
design.
B-Spline Basis: Motivation
B S li B i M i i
-
8/11/2019 Curve Modelling-B Spline
5/60
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 issubdividedby points called knots.
These knots be 0
-
8/11/2019 Curve Modelling-B Spline
6/60
B-Spline Basis: Motivation
In summary : to design a B-spline curve,
we need a set of control points, a set of
knotsand a set of coefficients, one for each
control point, so that all curve segments are
joined together satisfying certain continuity
condition.
-
8/11/2019 Curve Modelling-B Spline
7/60
B-Spline Basis: Motivation
The computation of the coefficients isperhaps the most complex step because they
must ensure certain continuity conditions.
-
8/11/2019 Curve Modelling-B Spline
8/60
B-Spline Curves
-
8/11/2019 Curve Modelling-B Spline
9/60
B-Spline Curves
(Two Advantages)
1. The degree of a B-spline polynmial canbe set independently of the number of
control points.
2. B-splines allow local control over the
shape of a spline curve (or surface)
-
8/11/2019 Curve Modelling-B Spline
10/60
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 thepolynomials (2,3, and 4)
Q3is 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.
-
8/11/2019 Curve Modelling-B Spline
11/60
B-Spline Curves(Two Advantages)
The effect of changingtheposition of control
point P4 (locality property).
-
8/11/2019 Curve Modelling-B Spline
12/60
B-Spline Curves
Bzier Curve B-Spline Curve
-
8/11/2019 Curve Modelling-B Spline
13/60
B-SplineBasis Functions
-
8/11/2019 Curve Modelling-B Spline
14/60
B-Spline Basis Functions
(Knots, Knot Vector) Let Ube a set of m+ 1non-decreasing
numbers, u0
-
8/11/2019 Curve Modelling-B Spline
15/60
B-Spline Basis Functions
(Knots, Knot Vector)
The half-open interval [ui, ui+1)is the i-th knot
span. Some ui's may be equal, some knot spansmay
not exist.
muuuuU ,,,, 210
-
8/11/2019 Curve Modelling-B Spline
16/60
B-Spline Basis Functions
(Knots)
If a knotuiappearsk times (i.e., ui= ui+1 = ... =
ui+k-1), where k > 1,uiis a multiple knotof
multiplicity k, written asui(k). If uiappears only once, it is a simple knot.
If theknotsare equally spaced(i.e., ui+1- uiis a
constantfor 0
-
8/11/2019 Curve Modelling-B Spline
17/60
B-Spline Basis Functions
All B-spline basis functions are supposedto have their domain on [u0, um].
We use u0= 0and um= 1frequently so thatthe domainis the closed interval [0,1].
-
8/11/2019 Curve Modelling-B Spline
18/60
B-Spline Basis Functions
To define B-spline basis functions, we need one
more parameter.
The degreeof these basis functions,p. The i-th B-
spline basis function of degreep, written as
Ni,p(u), is defined recursively as follows:
)()()(
otherwise0
if1)0(
1,1
11
1
1,,
1
0,
uNuu
uuuN
uu
uuuN
uuuN
pi
ipi
pi
pi
ipi
i
pi
ii
i
S i i i
-
8/11/2019 Curve Modelling-B Spline
19/60
B-Spline Basis Functions
The above is usually referred to as the Cox-de Boor
recursion formula.
If thedegreeis zero(i.e.,p = 0), these basis functionsare all step functions.
basis functionNi,0(u)is 1if uis in the i-th knot span
[ui, ui+1).
)()()(
otherwise0
if1)0(
1,1
11
11,,
1
0,
uNuu
uuuN
uu
uuuN
uuuN
pi
ipi
pipi
ipi
ipi
ii
i
We have four knots u0
= 0, u1
= 1,
u2= 2 and u3= 3, knot spans 0, 1
and2are [0,1), [1,2), [2,3)and the
basis functionsof degree0are
N0,0(u) = 1on [0,1)and 0
elsewhere,N1,0(u) = 1on [1,2)and
0 elsewhere, andN2,0(u) = 1on[2,3)and 0elsewhere.
-
8/11/2019 Curve Modelling-B Spline
20/60
B-Spline Basis Functions
To understand the way of computingNi,p(u)forp
greater than 0, we use the triangular computationscheme.
B S li B i F ti
-
8/11/2019 Curve Modelling-B Spline
21/60
B-Spline Basis Functions To computeNi,1(u),Ni,0(u) andNi+1,0(u) are required. Therefore, we
can computeN0,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 allNi,1(u)'s have been
computed, we can computeNi,2(u)'s and put them on the fourthcolumn. This process continues until all requiredNi,p(u)'s are
computed.
-
8/11/2019 Curve Modelling-B Spline
22/60
B-Spline Basis Functions
Since u0 = 0, u1 = 1 and u2 = 2, the above becomes
B S li B i F i
-
8/11/2019 Curve Modelling-B Spline
23/60
B-Spline Basis Functions
uis in [0,1): In this case, onlyN0,1(u) contributes to the value ofN0,2(u). Sinc
N0,1(u) is u, we have
uis in [1,2) : In this case, bothN0,1(u) andN1,1(u) contribute toN0,2(u). Since
N0,1(u) = 2 - uandN1,1(u) = u- 1 on [1,2), we have
u is in [2,3): In this case, only N1,1(u) contributes to N0,2(u). Since N1,1(u) = 3
u on [2,3), we have
-
8/11/2019 Curve Modelling-B Spline
24/60
B-Spline Basis Functions
-
8/11/2019 Curve Modelling-B Spline
25/60
Two ImportantObservation
-
8/11/2019 Curve Modelling-B Spline
26/60
Basis function Ni ,p(u) is non-zero on
[ui, ui+p+1). Or, equivalently, Ni ,p(u) isnon-zero on p+1 knot spans [ui, ui+1),
[ui+1, ui+2), ..., [ui+p, ui+p+1).
Two Important Observation
-
8/11/2019 Curve Modelling-B Spline
27/60
Two Important Observation
On any knot span [ui, ui+1), at most p+1
degree pbasis 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),
-
8/11/2019 Curve Modelling-B Spline
28/60
B-Spline Basis Functions
(Important Properties )
-
8/11/2019 Curve Modelling-B Spline
29/60
B-Spline Basis Functions
(Important Properties )
)()()(
otherwise0if1)0(
1,1
11
1
1,,
1
0,
uNuu
uuuN
uu
uuuN
uuuN
pi
ipi
pi
pi
ipi
i
pi
ii
i
1. Ni,p(u)is a degreeppolynomial in u.
2. Nonnegativity-- For all i,pand u,Ni,p(u)is non-negative
3. Local Support--Ni,p(u)is a non-zeropolynomial on[ui,ui+p+1)
-
8/11/2019 Curve Modelling-B Spline
30/60
B-Spline Basis Functions
(Important Properties )
4. On any span [ui, ui+1),at mostp+1 degreepbasis
functionsare non-zero,namely:Ni-p,p(u), Ni-p+1,p(u), Ni-
p+2,p(u), ..., and Ni,p(u).
5. The sumof all non-zero degreep basis functionson span
[ui, ui+1)is 1.
6. If the numberof knotsis m+1, the degreeof the
basis functionsisp, and the numberof degreep
basis functionsis n+1, then m = n + p + 1
-
8/11/2019 Curve Modelling-B Spline
31/60
B-Spline Basis Functions
(Important Properties )
7. Basis functionNi,p(u)is a composite curveofdegreeppolynomials withjoining pointsat knots
in [ui, ui+p+1)
8. At aknotof multiplicity k, basis functionNi,p(u)
is Cp-kcontinuous.
Increasing multiplicity decreases thelevel of continuity, and increasing
degree increases continuity.
-
8/11/2019 Curve Modelling-B Spline
32/60
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) andN3,0(u) defined on knot span [0,0.25,), [0.25,0.5), [0.5,0.75)
and [0.75,1), respectively.
-
8/11/2019 Curve Modelling-B Spline
33/60
B-Spline Basis Functions
(Computation Examples)
All Ni,1(u)'s(U= { 0, 0.25, 0.5, 0.75, 1 }(:
5.025.0)21(2
25.004)(
1,0
uu
uuuN
for
for
75.05.0for3
5.025.0for14)(1,1uuuuuN
175.0for)1(4
75.05.0for)12(2)(1,2
uu
uuuN
Since the internal knots 0.25, 0.5 and 0.75 are all simple(i.e., k= 1)
andp= 1, there arep - k+ 1 = 1 non-zerobasis function and three
knots. Moreover,N0,1(u),N1,1(u) andN2,1(u) are C0continuous at knots
0.25, 0.5 and 0.75, respectively.
B S li B i F ti
-
8/11/2019 Curve Modelling-B Spline
34/60
B-Spline Basis Functions
(Computation Examples) FromNi,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 areonly two basis functions of degree 2:N0,2(u) andN1,2(u).(U= { 0,
0.25, 0.5, 0.75, 1 }(:
each basis function is a compositecurve of three degree 2curve
segments.
composite curve is ofC1
continuity
175.0for)1(8
75.05.0for885.1
5.025.0for845.0
)(
2
2
2
2,1
uu
uuu
uuu
uN
75.05.0for8125.45.025.0for16125.1
25.00for8
)( 2
2
2
2,0
uuuuuu
uu
uN
-
8/11/2019 Curve Modelling-B Spline
35/60
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 andp= 0 (degree 0 basis functions), we have n=
m - p- 1 = 8. there are only fournon-zero basis functions of
degree 0:N2,0(u),N3,0(u),N5,0(u)andN6,0(u).
-
8/11/2019 Curve Modelling-B Spline
36/60
B-Spline Basis Functions
(Computation Examples)
Basis functions of degree 1:Sincepis 1, n= m - p- 1 = 7.The following table shows the result
asis 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
N7,1(u)
all u 0
-
8/11/2019 Curve Modelling-B Spline
37/60
B-Spline Basis Functions
(Computation Examples)
Basis functions of degree 1:
-
8/11/2019 Curve Modelling-B Spline
38/60
B-Spline Basis Functions
(Computation Examples) Sincep= 2, we have n= m - p- 1 = 6. The following table
contains allNi,2(u)'s:
Function Range Equation
N0,2
(u) [0, 0.3) (1 - (10/3)u)2
N
1,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)
N6,2
(u) [0.6, 1) 2.5(9 - 30u+ 25u2)
B Spline Basis Functions
-
8/11/2019 Curve Modelling-B Spline
39/60
B-Spline Basis Functions
(Computation Examples) Basis functions of degree 2:
Since its multiplicity is 2 and the degree of thesebasis functionsis
2, basis functionN3,2(u)is C0continuous at 0.5(2). This is whyN3,2(u)has a sharp angle at0.5(2).
For knots not at the two ends, say 0.3 and0.6,C1continuity is
maintained since all of them are simple knots.
U = { 0, 0, 0, 0.3, 0.5, 0.5, 0.6, 1, 1, 1{
-
8/11/2019 Curve Modelling-B Spline
40/60
B-SplineCurves
B Spline Curves
-
8/11/2019 Curve Modelling-B Spline
41/60
B-Spline Curves
(Definition) Given n+ 1control points P0, P1, ..., Pnand a knot vector
U= { u0, u1, ..., um},the B-spline curve of degreepdefinedby these control pointsand knot vector Uis
Thepoint on the curvethat corresponds to a knot ui, C(ui), is
referred to as a knot point.
The knot pointsdividea B-spline curve into curve segments,
each of which is defined on a knot span.
1,)()( 00
,
nmpuuuuNu m
n
i
ipi pC
B Spline Curves
-
8/11/2019 Curve Modelling-B Spline
42/60
B-Spline Curves
(Definition)
The degree of a B-spline basis function is an input.
To changetheshape of a B-spline curve, one can modifyone or more of these control parameters:
1. Thepositions of control points
2. Thepositions of knots
3. The degree of thecurve
1,)()( 00,
nmpuuuuNum
n
iipi pC
(Open Clamped & Closed B-Spline Curves)
-
8/11/2019 Curve Modelling-B Spline
43/60
(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 touchthe firstand last legs of the
control polyline.
Clamped B-spline curve: If the first knotand the last knotmultiplicityp+1, curve istangentto thefirst and the lastlegsat the first and last
control polyline, as a Bzier curvedoes.
Closed B-spline curves:Byrepeating someknotsand control points, the
generated curve can be a closedone. In this case, the start and the endofthe generated curvejoin togetherforming a closed loop.
Open B-Spline Clamped B-Spline Closed B-Spline
control points (n=9) and p = 3. m must be 13 so that the knot vector has 14 knots. To have the
clamped effect, the firstp+1 = 4 and the last 4 knots must be identical. The remaining 14 - (4
+ 4) = 6 knots can be anywhere in the domain. In fact, the curve is generated with knotvector U= 0, 0, 0, 0, 0.14, 0.28, 0.42, 0.57, 0.71, 0.85, 1, 1, 1, 1 .
-
8/11/2019 Curve Modelling-B Spline
44/60
OpenB-Spline Curves
-
8/11/2019 Curve Modelling-B Spline
45/60
Open B-Spline Curves
Recall from the B-spline basis function
property that on a knot span [ui, ui+1),thereare at mostp+1non-zero basis functionsof
degreep.
For open B-spline curves, the
domain is [up, um-p].
Open B Spline Curves
-
8/11/2019 Curve Modelling-B Spline
46/60
Open B-Spline CurvesExample 1:
knot vector U= { 0, 0.25, 0.5, 0.75, 1 }, where m= 4. If the
basis functions are of degree1 (i.e.,p= 1), there are threebasis functionsN0,1(u),N1,1(u)andN2,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-zerobasis functions while the second and third knot spans
(i.e., [0.25, 0.5)and [0.5, 0.75)) have two non-zerobasis
functions.
Open B Spline Curves
-
8/11/2019 Curve Modelling-B Spline
47/60
Open B-Spline CurvesExample 2:
-
8/11/2019 Curve Modelling-B Spline
48/60
-
8/11/2019 Curve Modelling-B Spline
49/60
ClampedB-Spline Curves
Clamped B-Spline Curves
-
8/11/2019 Curve Modelling-B Spline
50/60
Clamped B Spline Curves We use an exampleuse to illustrate the change between an open
curve and a clamped one:
An open B-splinecurve of degree 4, n= 8and a uniform knot
vector { 0, 1/13, 2/13, 3/13, ..., 12/13, 1 }.
Multiplicity 5(i.e.,p+1),(second, third, fourth andfifth knotto
0)the curve not onlypassesthrough the first control pointbut alsoistangent to the first legof the control polyline.
-
8/11/2019 Curve Modelling-B Spline
51/60
ClosedB-Spline Curves
Closed B-Spline Curves
-
8/11/2019 Curve Modelling-B Spline
52/60
Closed B Spline Curves To construct a closed B-splinecurve C(u)of degreepdefined
by n+1 control points,the number ofknots is m+1, We must:
1. Designan uniform knot sequenceof m+1 knots: u0= 0, u
1=
1/m, u2= 2/m, ..., um= 1.Note that the domain of the curve is [up, un-p].
2. Wrapthe firstpand lastpcontrol points. More precisely, letP0 = Pn-p+1, P1= Pn-p+2, ..., Pp-2= Pn-1andPp-1= Pn.
Closed B-Spline Curves
-
8/11/2019 Curve Modelling-B Spline
53/60
C osed Sp e Cu ves Example. Figure (a) shows an open B-splinecurve of degree
3defined by 10 (n= 9) control pointsand a uniform knot
vector.
In the figure, control point pairs0 and 7, Figure (b),1and 8,
Figure (c), and2and 9, Figure (d)are placed close to each
other to illustrate the construction.
a
-
8/11/2019 Curve Modelling-B Spline
54/60
Closed B-Spline Curves
a b
c
-
8/11/2019 Curve Modelling-B Spline
55/60
B-Spline CurvesImportant Properties
B-Spline Curves Important Properties
-
8/11/2019 Curve Modelling-B Spline
56/60
B Spline Curves Important Properties1. B-spline curve C(u) is a piecewise curve with each
component a curve of degreep.
Example:where n= 10, m= 14andp= 3, the first four knotsand last four knotsareclamped and the 7 internalknots are
uniformly spaced. There are 8 knot spans, each of which
corresponds to a curve segment.
Clamped B-Spline Curve Bzier Curve (degree 10!)
B-Spline Curves Important Properties
-
8/11/2019 Curve Modelling-B Spline
57/60
B Spline Curves Important Properties
2. Equality m= n+p+ 1must be satisfied.
3. Clamped B-splinecurve C(u)passes through the
two end control pointsP0and Pn.
4. Strong Convex Hull Property:A B-spline curve
is contained in the convex hull of its control
polyline.
B S li C I P i
-
8/11/2019 Curve Modelling-B Spline
58/60
B-Spline Curves Important Properties
5. Local Modification Scheme:changing the position of
control point Pionly affects the curve C(u) on interval[ui, ui+p+1).
The right figure shows the result of moving P2to the lower right corner. Only
thefirst, second and thirdcurve segmentschangetheir shapesand all remaining
curve segments stay in their original place without any change.
B-Spline Curves Important Properties
-
8/11/2019 Curve Modelling-B Spline
59/60
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 P6isN6,4(u), which is non-zero on [u6, u11). Thus, movingP6 affects curve segments 3, 4, 5, 6 and 7. Curve segments 1, 2, 8 and 9 are
not affected.
B S li C I t t P ti
-
8/11/2019 Curve Modelling-B Spline
60/60
B-Spline Curves Important Properties
6. C(u) is Cp-kcontinuous at a knot of multiplicity k
7. Affine Invariance