Aigner_Lecture.pdf

JOHANNES KEPLER UNIVERSITY LINZ
INSTITUTE OF APPLIED GEOMETRY
Dr. M. Aigner
Non-linear Computational Geometry
Shape Representations
CIMPA Summer School 2011
Mag. DI. Dr. M. Aigner,
Johannes Kepler University Linz, Austria
Institute for Applied Geometry
2
1
1 INTRODUCTION
Introduction
Computer Aided Geometric Design (CAGD) is an interdisciplinary research field between
computer science and applied mathematics. Amongst others, CAGD uses results and
techniques which originate in
• Computergraphics
• Geometry (descriptive geometry, algebraic geometry, differential geometry a.o.),
• numerical mathematics
• approximation theorie
Generally speaking, CAGD is concerned with methods for computer aided design, construction, simulation and production of various articles and objects. Classicals fields of
applications are
• automotive industry,
• aircraft industry
• ship industry.
In those fields the need to describe (complicated) geometrical shapes with computers originated already quite early. Over the years those techniques found applications in other fields
such as the film industry, machine building and in the development of computer games.
At the origin of this developement process can be found two french ingeneers, Pierre Bézier
(Renault), and Paul de Faget de Casteljau (Citroën), which developped (independently?)
in the 60’s of the last century the first computer supported techniques for surface construction.
Figure 1: Pierre Bézier and Paul de Faget de Casteljau
3
2
Bézier curves
Bézier curves are one of the most commonly used descriptions of free form curves. For
instance, they are used in the graphical programming language Postscript.
2.1
Traditional representations of polynomial curves
Polynomial curves
Definition 2.1 A segment of a polynomial curve of degree n in Rd (d = 2, 3) with
the parameter space [a, b] (mainly with [a, b] = [0, 1]) is a mapping
p : I = [a, b] ⊂ R −→ Rd
(1)
whose components (coordinate functions) p1 , . . . , pd are polynomials with (at most) degree
n.
The polynomial curves of degree n in Rd form a (n + 1)d–dimensional vector space. In this
vector space we are free to choose different basis. We mention some of the most commonly
used and discuss their advantages/disadvantages:
Standard– or monomial description
... of a polynomial curve is the “usual”representation with respect to the basis of monomials
(“power basis”) {1, t, t2 , t3 , . . . , tn }:
p(t) =
n
X
ci ti ,
c i ∈ Rd
i=0
✓ Efficient evaluation (i.e. computation of a point) of the curve via Horner scheme.
✗ The coefficients ci possess no geometrical meaning, they contain no information about
the shape of the curve.
✗ Piecing together (piecewise polynomial) curves with a certain smoothness (continuity) is not easy.
Lagrange representation
of a curve is given by n+ 1 control points p0 , . . . , pn with n+ 1 associated parameter values
u0 < . . . < un :
p(t) =
n
X
i=0
pi Lni (t),
pi ∈ Rd
4
2 BÉZIER CURVES
1
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
0.8
0.6
0.4
0.2
0.2
0.4
0.6
0.8
1
x
–0.2
0
0.2
0.4
0.6
0.8
0
0.2
1
0.4
0.6
0.8
1
x
x
Figure 2: Bases of monomial, Lagrange– and Hermite–polynomials of degree 3.
Lni (t) are the so-called Lagrange–polynomials of degree n for the given parameter values
(knots) u0 < . . . < un ,
Y uj − u
1, i=k
n
n
Li (u) =
with Li (uk ) =
(2)
0, i6=k
uj − ui
j6=i
✓ The curve interpolates the points pi .
✓ Efficient recursive evaluation – Newton’s interpolation polynomial.
✗ Unwanted oscillations of the curve, especially for high degrees n.
✗ Choice of ui is a non-trivial problem!
✗ Piecing together (piecewise polynomial) curves with a certain smoothness (continuity) is not easy.
• Application: Finite Elemente Method (for low degrees)
Hermite representation
of a polynomial curve segment with degree n, n odd, is given via the end points pi and
associated derivative vectors Dt p0 , Dt2 p0 , . . . ,:
n
(t) + p1 Hnn (t) pi ∈ Rd .
p(t) = p0 H0n (t) + Dt p0 H1n (t) + · · · + Dt p1 Hn−1
Hin (t) are the Hermite interpolation polynomials of degree n.
5
2.2 Bézier curves
✓ The description is for low degrees intuitive: n = 3: The curve interpolates the end
points and the tangent vectors; n = 5: the curve interpolates furthermore the second
order derivatives
✗ ... meaningful for high degrees?
✓ Piecing together (piecewise polynomial) curves with a certain smoothness (continuity) is easy.
✗ The basis functions Hin (t) are rather complicated for higher degrees
✗ Evaluation of Hermite polynomials is rather costly.
2.2
Bézier curves
Definition 2.2 A polynomial curve in Bernstein–Bézier– (BB–) description or Bézier
curve for short, is given via
n
X
p(t) =
bi Bin (t), t ∈ [a, b], bi ∈ Rd
(3)
i=0
with the (generalized) Bernstein polynomials
n (b − t)n−i (t − a)i
n
Bi (t) =
i
(b − a)n
(4)
of degree n. The vector valued coefficients bi are called control points (or Bézier points).
They form the control polygon (or Bézier polygon).
The control polygon gives a rough idea about the shape of the curve and can therefor be
used for curve generation/modification.
Bernstein polynomials
In the following we analyze some of the properties of the Bernstein polynomials. Exemplarily, we consider cubic Bernstein polynomials, see Fig. 3.
Remark 2.3
sum
1. The Bernstein polynomials Bin (t) are the summands of the binomial
1 =
t−a
b−t
+
b−a b−a
n
=
= B0n (t) + B1n (t) + . . .
n−j j
n X
b−t
t−a
n
j
j=0
+ Bnn (t).
b−a
b−a
Accordingly, they form a partition of 1.
2. Sometimes the functions (4) are called ”‘generalized”’ Bernstein polynomials and the
polynomials for [a, b] = [0, 1] are called Bernstein polynomials.
6
2 BÉZIER CURVES
1
0.8
0.6
0.4
0.2
0
0
0.2
0.4
x
0.6
0.8
1
Figure 3: Cubic Bernstein polynomials.
Recursion of the Bernstein polynomials
Lemma 2.4 The Bernstein polynomials fulfill the recursion
Bin (t) =
t − a n−1
b − t n−1
Bi (t) +
B (t),
b−a
b − a i−1
i = 0, . . . , n
where B00 (t) ≡ 0 and Bjn (t) ≡ 0 for all n ∈ N, j ∈
/ {0, . . . , n}.
Derivatives of the Bernstein polynomials
Lemma 2.5 For the derivatives of the Bernstein polynomials it holds that
Bin ′ (t) =
n
n−1
Bi−1
(t) − Bin−1 (t) ,
b−a
t ∈ [a, b]
(5)
and, more generally for higher derivatives(k = 0, . . . n)
k
X
n!
dk n
n−k
k k
Bi−k+j
(t),
B (t) =
(−1)
j
dtk i
(n − k)!(b − a)k j=0
t ∈ [a, b].
(6)
Further properties of the Bernstein polynomials
Lemma 2.6
1. The Bernstein polynomials are non-negative in the interval [a, b]:
n
Bi (t) ≥ 0 for all t ∈ [a, b].
2. The Bernstein polynomials form a partition of 1,
n
X
i=0
Bin (t) = 1.
(7)
7
2.2 Bézier curves
n
3. They are symmetric: Bin (t) = Bn−i
(b − t).
4. The polynomial Bin (t) has a root at t = a with multiplicity i and a root at t = b with
multiplicity (n − i).
5. The polynomial Bin (t) has exactly one maximum in the interval I := [a, b], which is
at t = a + ni (b − a).
Derivatives of a Bézier curve
Lemma 2.7 The first derivative of a Bézier curve is
n−1
n X
p (t) =
(bi+1 − bi )Bin−1 (t),
b − a i=0
′
t ∈ [a, b]
(8)
and derivatives of higher degree are given by
n−k
X
dk
n!
∆k bi · Bin−k (t),
p(t) =
dtk
(n − k)!(b − a)k i=0
t ∈ [a, b].
(9)
The coefficients
k
bi+k−j
∆ bi :=
(−1)
j
j=0
k
k
X
j
(10)
are called k–th forward differences of the control points.
Example 2.8 The first derivative of a cubic Bézier curve
p(t) = B03 (t)b0 + B13 (t)b1 + B23 (t)b2 + B33 (t)b3
(11)
p′ (t) = 3(B02 (t)(b1 − b0 ) + B12 (t)(b2 − b1 ) + B22 (t)(b3 − b2 )).
(12)
is given by
Derivatives at the boundary
Lemma 2.9 The derivatives of order k of a Bézier curve in its end points t = a and
t = b depends only on the control points b0 , . . . , bk and bn−k , . . . , bn , respectively.
Example 2.10
p(a) = b0 ,
n
(b1 − b0 ),
b−a
n(n − 1)
p′′ (a) =
(b2 − 2b1 + b0 ),
(b − a)2
p′ (a) =
p(b) = bn
n
(bn − bn−1 )
b−a
n(n − 1)
p′′ (b) =
(bn − 2bn−1 + bn−2 )
(b − a)2
p′ (b) =
(13)
8
2 BÉZIER CURVES
2.3
The algorithm of de Casteljau
Originally, Paul de Faget de Casteljau defined the Bézier curves (called ”‘courbes à pôles”’)
not via the basis functions (Bernstein polynomials), but as the solution of an algorithm
(that was later named after him):
• Input: b0 , . . . , bn , t
• Initialization: b0i := bi , i = 0, . . . , n.
• Recursion:
bri =
b − t r−1 t − a r−1
b
+
b ,
b−a i
b − a i+1
r = 1, . . . , n,
i = 0, . . . , n − r
(14)
• Result: bn0 = p(t)
A scheme of the algorithm is shown in Fig. 4.
b0
k
b00
b1
k
b01
ց
ւ
ց
b10
b11
ց
ւ
b20
ց
···
···
···
···
···
···
···
···
..
.
bn−1
k
b0n−1
ւ
bn
k
b0n
ց
b1n−2
ւ
b1n−1
ց
ւ
b2n−2
ւ
bn0 = p(t)
b−t
t−a
where t ∈ [a, b] and ց= · b−a
and ւ= · b−a
.
Figure 4: Scheme: the de Casteljau–Algorithm.
Theorem 2.11 The algorithm of de Casteljau computes the points of a Bézier curve.
Proof(idea): “Counting the paths”, see Fig. 5.
Geometric Interpretation
The algorithm of de Casteljau can be interpreted geometrically, see Fig. 6. The points of
generation r + 1 are computed from the points of the previous generation r by transferring
the ratio (1 − t) : t to the polygon br0 , . . . , brn−r .
9
2.3 The algorithm of de Casteljau
3
1
3
1
Figure 5: Idea for the proof of the de Casteljau–algorithm.
b02
b11
b01
2
b0
3
0
b21
b =p(t)
1
0
b
1
b2
b03
0
0
b
a
b
b-t a + t-a b
t = b-a
b-a
Figure 6: Geometric interpretation of the algorithm of de Casteljau.
Corollary 2.12 The description of a polynomial curve via its Bézier polygon is affin invariant.
Also the derivatives of a Bézier curve can be computed via the algorithm of de Casteljau:
Theorem 2.13 The derivatives of order k of a Bézier curve are given by
n!
dk
p(t) =
∆k b0n−k Bin−k (t),
k
dt
(n − k)!(b − a)k
k = 0, . . . , n
(15)
with the forward differences
k
∆
b0n−k
k n−k
b .
=
(−1)
j k−j
j=0
k
X
j
(16)
Further properties of Bézier curves
Theorem 2.14 (Convex–Hull–property) A Bézier curve is always contained in the
convex hull of its control polygon.
Application: Collision detection, computation of intersection/roots.
The control polygon of a Bézier curve ”‘imitates”’ the shape of the curve. Mathematically,
this is called “Variation diminution property”.
10
3 BLOSSOMING
Theorem 2.15 (Variation diminution) The number of intersections with a hyper plane
(d = 2: line, d = 3: plane) does not exceed the number of intersections of the control
polygon with this hyper plane.
Corollary 2.16 If the control polygon of a Bézier curve is convex, the curve is convex,
too.
Remark 2.17 The control polygon is said to be convex, if the region which is bounded
by the polygon b0 , . . . , bn is convex.
3
Blossoming
Blossoming is a powerful tool for constructing spline curves. First, we shall introduce
the concept of a blossom for polynomials and apply it afterwards to the algorithm of de
Casteljau.
3.1
The blossom of a polynomial
Definition 3.1 Let p : R −→ Rd be a polynomial of degree n. The function f
f:
Rn → Rd :
(t1 , . . . , tn ) 7→ f (t1 , . . . , tn )
(17)
is called blossom of p, if:
1. f is symmetric (or, equivalently, ”‘total symmetric”’), i.e., for each permutation π
of the set {1, . . . , n} it holds that
f (t1 , . . . , tn ) = f (tπ(1) , . . . , tπ(n) )
(18)
2. f is n–affine, i.e., the function f is linear in each of its variables, i.e.,
f (. . . , ati + bsi , . . .) = a f (. . . , ti , . . .) + b f (. . . , si , . . .)
(19)
for all a, b, ti , si with a + b = 1, and
3. the restriction of f to its diagonal gives p, i.e.
f (t, . . . , t) = p(t).
(20)
Example 3.2 A (the) blossom of a cubic polynomial
p(t) = a0 + a1 t + a2 t2 + a3 t3
is
f (t1 , t2 , t3 ) = a0 +
a1
a2
(t1 + t2 + t3 ) + (t1 t2 + t2 t3 + t3 t1 ) + a3 t1 t2 t3 .
3
3
(21)
(22)
11
3.1 The blossom of a polynomial
The ”‘Blossoming–principle”’
Theorem 3.3 Each polynomial p : R −→ Rd of degree n possesses a unique blossom f .
Proof. First we show how a blossom
may be constructed from the BB-representation of
P
the polynomial p. Let p(t) = ni=0 bi Bin (t) : R −→ Rd be a polynomial of degree n. We
consider the following modified version of the algorithm of de Casteljau:
bki (t1 , . . . tk ) =
b − tk k−1
tk − a k−1
bi (t1 , . . . tk−1 ) +
b (t1 , . . . tk−1 ).
b−a
b − a i+1
(23)
In step k of the modified algorithm of de Casteljau we replace t by tk . One can verify easily
that the function
bki = bki (t1 , . . . , tn )
(24)
is n-affine and symmetric. Therefor it is a blossom of the given polynomial.
On the other hand let f be an n–affine and symmetric function, and t be an arbitrary
t−a
b−t
a + b−a
b. Then it holds that
parameter value, t = b−a
b−t
t−a
f (t, . . . , t) =
f (a, t, . . . , t) +
f (b, t, . . . , t)
| {z }
| {z }
| {z }
b−a
b−a
n
n−1
(25)
n−1
and with the recursion of the (generalized) Bernstein polynomials if follows that
p(t) = f (t, . . . , t) =
| {z }
n
n
X
i=0
f (a, . . . , a, b, . . . , b)Bin (t)
| {z } | {z }
n−i
(26)
i
Finally, it can be seen that the blossom can be evaluated at each position (t1 , . . . , tn ) via
the modified algorithm of de Casteljau, see Figure 7.
f (a, . . . , a) f (a, . . . , a, b)
ց
ւ
ց
f (a, . . . , a, t1 ) f (a, . . . , t1 , b)
ց
ւ
ց
f (a, . . . , a, t1 , t2 )
ց
·········
·········
·········
·········
·········
·········
..
.
f (a, b, . . . , b) f (b, . . . , b)
ւ
ց
ւ
f (a, t1 , b, . . . , b) f (t1 , b, . . . , b)
ւ
ց
ւ
f (t1 , t2 , a, . . . , a)
ւ
f (t1 , . . . , tn )
Figure 7: Modified algorithm of de Casteljau
Summing up, we have shown that
12
3 BLOSSOMING
1. For a polynomial p the the Bézier control points coincide with the blossom that is
evaluated at the positions
bi = f (a, . . . , a . b, . . . , b)
| {z } | {z }
n−i
(27)
i
Therefor the values of the blossom are uniquely determined by the polynomial p.
2. On the other hand, the blossom of a polynomial can be evaluated at an arbitrary
position (t1 , . . . , tn ) via the algorithm of de Casteljau.
3.2
Bézier curves
Corollary 3.4 Let p be a polynomial of degree n, and let f be a blossom Then
bi = f (a, . . . , a, b, . . . , b)
| {z } | {z }
n−i
(28)
i
are the Bézier control points of the BB–representation
p(t) =
n
X
bi Bin (t)
(29)
i=0
of the polynomial p with respect to the interval [a, b].
Blossoming and the algorithm of de Casteljau
Using the blossom principle, the algorithm of de Casteljau is just the evaluation of the
blossom at a certain position, see Fig. 8 and 9.
f (a, . . . , a) f (a, . . . , a, b)
ց
ւ
ց
f (a, . . . , a, t) f (a, . . . , t, b)
ց
ւ
ց
f (a, . . . , a, t, t)
ց
·········
·········
·········
·········
·········
·········
..
.
f (a, b, . . . , b) f (b, . . . , b)
ւ
ց
ւ
f (a, t, b, . . . , b) f (t, b, . . . , b)
ւ
ց
ւ
f (t, t, a, . . . , a)
ւ
f (t, . . . , t) = p(t)
Figure 8: Blossoming and the algorithm of de Casteljau (Scheme).
13
3.3 Subdivision of Bézier curves
f(a,b,b)
f(a,t,b)
f(a,a,b)
f(a,t,t)
f(t,t,b)
f(t,t,t)= p(t)
f(a,a,t)
f(t,b,b)
f(b,b,b)
f(a,a,a)
Figure 9: Blossoming and the algorithm of de Casteljau.
Example 3.5 Consider the function f (t) = t. Its blossom (if interpreted as polynomial
of degree n) is
1
(30)
f (t1 , . . . , tn ) = (t1 + . . . + tn )
n
and has with respect to the interval [a, b] the control points
bi =
n−i
i
a + b,
n
n
i = 0, . . . , n.
(31)
If one wishes to represent the polynomial p(t) as parametric Bézier curve p(t) = (t, p(t)),
the abscissae of the control points are given by (31).
3.3
Subdivision of Bézier curves
Theorem 3.6 Using the algorithm of de Casteljau, one can split a Bézier curve p of
degree n and the parameter interval [a, b] in two Bézier curves p0 , p1 with the parameter
intervals[a, t] and [t, b]. These curves possess the control points
bk0 (t) = f (a, . . . , a, t, . . . , t),
| {z } | {z }
n−k
k
k = 0, . . . , n
and bkn−k (t) = f (t, . . . , t, b, . . . , b)
| {z } | {z }
n−k
(32)
k
Proof. The proof follows directly via the combination of the algorithm of de Casteljau
and the blossom principle.
Figure 10 shows an example.
De Casteljau–Extrapolation
Remark 3.7 Of course one can also compute the BB–representation of a curve with respect to a parameter interval that is bigger than the original one. For instance one can
14
3 BLOSSOMING
2
b0
2
b1
3
b0
1
b0
p
p0
1
b2
p1
b03
0
b0
Figure 10: Subdivision of a Bézier curve.
interpret the control points (see Fig. 10)
b00 = f (a, a, a),
b10 = f (a, a, t),
b20 = f (a, t, t),
b30 = f (t, t, t)
(33)
of the BB–representation with respect to [a, t] as given and extrapolate the control points
with respect to the interval [a, b].
However, in contrast to parameter values inside the interval, the algorithm is numerically
not stable in this situation.
Convergence under subdivision
Theorem 3.8 When repeating the subdivision of a Bézier curve via the de Casteljau algorithm, the obtained control points converge towards the curve, assumed that the lengths
of the segments converge towards 0.
Proof. Since the blossom is a continuous function, it holds that
lim
a→t0 ,b→t0
f (a, . . . , a, b, . . . , b) = f (t0 , . . . , t0 ) = p(t0 ).
| {z } | {z }
n−i
(34)
i
With the help of the subdivision technique one can generate a series of polygons that
converges (quite fast) towards a given Bézier curve. Accordingly, for drawing a Bézier
curve one should prefer this technique rather than point evaluation along the curve.
15
3.4 Degree elevation
3.4
Degree elevation
Each Bézier curve of degree n can also be represented as a Bézier curve of degree n + 1,
p(t) =
n
X
bi Bin (t) =
i=0
Computing the control points
b∗i
n+1
X
b∗i Bin+1 (t)
(35)
i=0
is often referred to as degree elevation.
Theorem 3.9 Let p be a Bézier curve of degree n with control points b0 , . . . , bn and f its
blossom, and let f ∗ be its blossom as curve of degree n + 1. Then it holds that
n+1
1 X
f (t1 , . . . , tn+1 ) =
f (t1 , . . . , ti−1 , ti+1 , . . . , tn+1 ).
n + 1 i=1
∗
(36)
The control points bi , b∗i fulfill the condition
b∗i = (1 −
i
i
)bi +
bi−1 ,
n+1
n+1
i = 0, . . . n + 1,
(37)
where b−1 = bn+1 = 0.
Proof. It is easy to verify that the function f ∗ is indeed the blossom of a polynomial of
degree n + 1.
Theorem 3.10 After r degree elevations (from n to n + r) one obtains the control points
r n
X
n i−j
(r)
i = 0, . . . , n + r
(38)
bi =
bj
n+r ,
j
i
j=0
Theorem 3.11 The series of control polygons obtained during a repeated degree elevation
converges towards the curve p.
(Without proof.)
Comparison between subdivision and degree elevation.
Remark 3.12 Figure 11 shows degree elevation (right) and subdivision (left) for a cubic
Bézier curve.
The subdivision of a Bézier curve doubles in each step (roughly) the number of control
points. Therefor one obtains after a small number of subdivision steps a polygon that
approximates the curve quite well. Moreover, one can trigger the refinement of the polygon locally for example with respect to the size of the second order forward differences
(∼deviation from a straight line).
During the repeated degree elevation process one adds in each step only one control point.
Consequently, the curve is approximated rather slowly. Therefore, degree elevation is not
suitable for an efficient visualization of a curve. Instead, it is mainly used for generating
additional degrees of freedom (design parameter) for individual curve segments.
16
3 BLOSSOMING
1 segment
degree 3
2 segments
degree 4
4 segments
degree 5
8 segment
degree 6
16 segments
... degree 48
Figure 11: Subdivision (left) and degree elevation (right) of a cubic Bézier curve.
17
3.5 Derivatives and blossoming
3.5
Derivatives and blossoming
In a later chapter we will use blossoming for the construction of spline curves. As a basis
we investigate in the following a contact condition between two curves.
Computation of a derivative
Theorem 3.13 Let p be a vector valued polynomial R → Rd (resp. a Bézier curve) and f
its associated blossom. Then the derivative is given by
n
p′ (t) =
(39)
(f (t, . . . , t, b) − f (t, . . . , t, a))
| {z }
b − a | {z }
n−1
n−1
More generally, the derivative of order l (1 ≤ l ≤ n), is given by:
l
n(n − 1) · · · (n − l + 1) X
l−i l
f (t, . . . , t, a, . . . , a, b, . . . , b)
p (t) =
(−1)
| {z } | {z } | {z }
i
(b − a)l
i=0
(l)
n−l
l−i
(40)
i
Proof. Since the blossom f = f (t1 , . . . , tn ) is symmetric it holds that
p′ (t) =
n
X
∂
∂
f (t, . . . , t) = n
f (t, . . . , t)
| {z }
| {z }
∂t
∂t
i
1
i=1
n
(41)
n
As the blossom f is furthermore a polynomial of degree 1 in t1 , its derivative can be
computed via a difference quotient. This fact gives formula (39).
For the proof of formula (40) we repeat this technique. We note that the blossom f [1] of
the first derivative p′ is obviously
n
f [1] (t1 , . . . , tn−1 ) =
(f (t1 , . . . , tn−1 , b) − f (t1 , . . . , tn−1 , a)).
(42)
b−a
Combining (42) with (39) gives the desired result.
Contact condition
The formula for the derivatives yields a condition for the contact between two polynomials
Theorem 3.14 Let p, q : R −→ Rd be two vector valued polynomials (two Bézier curves)
of degree n and f, g their blossoms. We consider a point t ∈ R and an order r ∈ N, r ≤ n.
Then it follows: The function values and the first r derivatives of both polynomials in the
point t coincide,
p(k) (t) = q(k) (t), k = 0, . . . , r
(43)
if and only if the two blossoms fulfill
f (t1 , . . . , tr , t, . . . , t) = g(t1 , . . . , tr , t, . . . , t) for arbitrary t1 , . . . tr ∈ R
| {z }
| {z }
n−r
n−r
(44)
18
4 B-SPLINE–CURVES
Proof. ⇒: follows immediately from the formula for the derivatives of Bézier curves
(Theorem 3.13).
⇐: Consider the Bézier representation of the two curves with respect to the parameter
interval [t, b], t < b. If the function values and the first r derivatives coincide at t, the first
r + 1 control points of the two curves coincide (see Theorem 2.7). Consequently, it holds
that
f (t, . . . , t) = g(t, . . . , t)
| {z }
| {z }
n
n
f (t, . . . , t, b) = g(t, . . . , t, b)
| {z }
| {z }
n−1
n−1
..
.
f (t, . . . , t, b, . . . , b) = g(t, . . . , t, b, . . . , b)
| {z } | {z }
| {z } | {z }
n−r
r
n−r
(45)
r
With the generalized algorithm of de Casteljau (see Fig. 7) we can compute from these
values of the blossoms the values at an arbitrary position
f (t, . . . , t, t1 , . . . , tr ) = g(t, . . . , t, t1 , . . . , tr ).
| {z }
| {z }
n−r
(46)
n−r
Clearly, those values have to coincide.
Corollary 3.15 Two Bézier curves p(t), q(t) of degree n have in the point t a contact of
order r (0 ≤ r ≤ n), if and only if their blossoms coincide on each n–tuple that contains t
at least n − r times.
4
B-spline–curves
The blossoming principle offers an elegant approach to the theory of B-spline curves.
4.1
Draw backs of polynomial curves
Why do we need spline curves?
• Increasing the number of control points in order to obtain a higher flexibility of a
curve might lead to a high degree of the curve.
• Each control point has global influence on the curve.
• For a high number of control points the influence of a single control point looses its
geometric intuition.
The solution:
Using piecewise polynomial curves, so-called spline curves.
19
4.2 Spline curves
4.2
Spline curves
Definition 4.1 A polynomial spline curve x : [a, b] → Rn of degree d with the knots
a = t0 < t1 < . . . < tN −1 < tN = b is a piecewise polynomial curve, i.e., in each interval
[ti , ti+1 ] the curve is a polynomial curve of degree d in the sense of definition 2.1. We
assume that the single segments are connected at the knots with a certain differentiability,
but at least they are C 0 (continuous).
Remark 4.2
1. The maximal differentiability of a polynomial spline curve of degree d
is C d−1 (continuity of the (d − 1)-th derivative).
2. The name “spline” originates in the englisch ship building industry. In the early
19th century flexible metal bars where used for modeling free form curves. Certain
points where fixed with with so-called “ducks” in order to create the wanted curves,
see Figure 12. The resulting curves have, due to their material properties minimal
curvature.
Figure 12: Interpolation of points with a “spline”.
After some simplifications(κ ≈ f ′′ ) one can model this construction via a simple
variational problem: We search for a function f , that interpolates certain points
(f (xi ) = yi ), and which minimizes the integral:
Z
b
f ′′ (x)2 dx → Min
(47)
a
This variational problem leads to cubic, interpolating C 2 –splines with natural boundary conditions:
f ′′ (a) = f ′′ (b) = 0.
(48)
p
3. Due to κ = f ′′ / (1 + f ′2 )3 , the cubic splines are only for small slopes (f ′ ≈ 0) a good
approximation for the curves that are generated through the mechanical process.
20
4 B-SPLINE–CURVES
4. Sometimes only curves that are a solution of such a variational problem are called
spline curves. In the case of piecewise polynomial curves this is only true for curves
with odd degrees - curves with degree 2d − 1 minimize the integrals over the squares
of the derivatives of order d. However, the name spline becomes more and more
common for every piecewise defined curve.
Basis representation
Similar to Bézier curves we can also use in the situation of splines a basis representation
x(t) =
N
X
Ni (t)di ,
t ∈ [a, b].
(49)
i=0
The basis functions Ni (t) are piecewise polynomials that give through their properties some
geometric meaning to the vector valued coefficients (“control points”) di .
There exist at least 3 different possibilities to define the basis functions Ni (B(asis)–
Splines):
a) “Divided Differences”. This classical approach is mainly used in approximation oriented literature (Carl de Boor: A practical guide to Splines; Larry L. Schumaker:
Spline functions – Basic theory).
b) Simplex–Splines: The basis function of degree d is found as the projection of a
simplex from Rd+1 to R1 . This very elegant approach can also be generalized to the
bivariate case. Nevertheless, the associated algorithms become relatively complex in
this framework.
c) Blossoming: In the following we shall use this approach. It allows for an easy introduction of the algorithms in the B-spline context.
4.3
de Boor’s algorithm
This algorithm is a generalization of the modified algorithm of de Casteljau (vgl. (23)).
De Boor control points of a segment
Let the “knots” t1 , . . . , t2m ∈ R be given with
ti ≤ ti+1
and ti < ti+m ,
(50)
i.e., each knot has a multiplicity at most m. Furthermore, let x(t) be a polynomial curve
of degree m and f its blossom.
Definition 4.3 The m + 1 points
f (ti+1 , . . . , ti+m ) = hi ,
i = 0, . . . , m
are called de Boor control points of the curve with respect to the knots t1 , . . . , t2m .
(51)
21
4.3 de Boor’s algorithm
Evaluation of a blossom
The blossom may be evaluated at each position f (τ1 , . . . , τm ) by using the convex combinations
f (ti+1 , . . . , ti+m−k , τ1 , . . . , τk )
= (1 − αik (τk )) f (ti , . . . , ti+m−k , τ1 , . . . , τk−1 )
+ αik (τk ) f (ti+1 , . . . , ti+m−k+1 , τ1 , . . . , τk−1 ),
i = k, . . . , m;
where
αik (τ ) =
(52)
k = 1, . . . , m,
τ − ti
ti+m−k+1 − ti
(53)
The resulting triangular scheme is shown in 13.
f (t1 , . . . , tm ) f (t2 , . . . , tm+1 )
···
f (tm , . . . , t2m−1 ) f (tm+1 , . . . , t2m )
ց
ւ
ց
···
ւ
ց
ւ
f (t2 , . . . , tm , τ1 ) f (t3 , . . . , τ1 , tm+1 ) · · · f (τ1 , tm , . . . , t2m−2 ) f (τ1 , tm+1 , . . . , t2m−1 )
ց
ւ
ց
···
ւ
ց
ւ
f (t3 , . . . , tm , τ1 , τ2 )
···
f (τ1 , τ2 , tm+1 , . . . , t2m−2 )
ց
···
ւ
..
.
f (τ1 , . . . , τm )
Figure 13: de Boor–algorithm for blossom evaluation
Computation of a curve point
The special choice τ = τ1 = . . . = τm results in the function value x(τ ) = f (τ, . . . , τ ). One
obtains de Boor’s algorithm:
1. Input: De Boor points hj of the polynomials curves with respect to the knots
t1 , . . . , t2m , as well as the parameter values τ .
2. Initialization: Set h0j := hj for j = 0, . . . , m.
3. Recursion:
k−1
k
k
(τ ))hik−1 + αi+k
(τ )hi+1
,
hki = (1 − αi+k
i = 0, . . . , m − k;
k = 1, . . . , m.
(54)
4. Result: x(τ ) = hm
0
Remark 4.4
1. In contrast to the algorithm of de Casteljau the weights change in
general in each intermediate step of the point computation.
22
4 B-SPLINE–CURVES
2. The weights αjk (τ ) are equal to the barycentric coordinates of the parameter τ with
respect to the interval[tj , tj+m−k+1].
3. The weights (in all generations) are non-negative for t ∈ [tm , tm+1 ]. In this case the
algorithm is numerically stable.
4. For the special choice t1 = . . . = tm = a and tm+1 = . . . = t2m = b, one gets the
algorithm of de Casteljau.
5. The algorithm of de Boor can be interpreted as a geometrical construction. The
ratios that are defined by the parameter values τ and the parameter interval given
by the knots are successively transferred to the polygon which is defined by the
control points, see Figure 14.
tau
2
h1
x
t0
t1
t2
t3
t4
t5
t6
t7
1
h0
x
x
x
h0
1
h1
2
h1
h2
1
h2
3
h0 = p(tau)
h3
x
x
x
h0
De Boor--Algorithm for a cubic curve
Figure 14: Geometric interpretation of de Boor’s algorithm
6. The description of a curve via its de Boor points is again affine invariant. In contrast to a Bézier curve the first and the last control points do not coincide with
the boundary points of the curve. The curve segment t ∈ [tm , tm+1 ] is somehow
“floating”.
4.4
Construction of spline curves
Using corollary 3.15 we will now define piecewise polynomial curves with given differentiability.
23
4.4 Construction of spline curves
Two segments
We consider the following non-decreasing knot sequence with 2m + 1 + r knots,
sj ≤ sj+1 ≤ . . . ≤ sj+m−1 < sj+m = . . . = sj+m+r < sj+m+1+r ≤ . . . , sj+2m+r ,
|
{z
}
multiplicity r + 1
(55)
where at most m consecutive knots coincide, i.e. sk < sk+m , see Figure 15. Note that
r = 0 is allowed, and j ∈ N is a fixed starting index of the knot sequence.
Knoten für x’
Knoten für x’’
Kontrollpunkte
Figure 15: knot sequence and associated control points for m = 3 and r = 1.
For each m–tuple of neighbouring knots let a de Boor control point be given,
dk ∼ (sk , . . . , sk+m−1 ),
k = j, . . . , j + m + 1 + r.
(56)
These knots and the de Boor points define two polynomial curves. The first curve x′
possesses the knot sequence
t′1 = sj , t′2 = sj+1 , . . . , t′2m = sj+2m−1
(57)
h′0 = dj , h′1 = dj+1 , . . . , h′m = dj+m .
(58)
and the de Boor points
The second curve x′′ has the knot sequence
t′′1 = sj+1+r , t′′2 = sj+2+r , . . . , t′′2m = sj+2m+r
(59)
and the de Boor points
h′′0 = dj+1+r , h′′1 = dj+2+r , . . . , h′′m = dj+m+1+r .
(60)
Theorem 4.5 The first m − 1 − r derivatives of the two curves coincide for the parameter
value τ = sj+m = t′m+1 = t′′m ; the curves have at this position a C m−1−r transition (contact
of order m − 1 − r).
Proof. This fact follows immediately from corollary 3.15. The blossoms of the two
polynomials agree on each m–tuple that contains the parameter value τ at least (r + 1)
times.
24
4 B-SPLINE–CURVES
Several segments
In the following we define spline curves in B-spline representation.
Definition 4.6 We consider a non-decreasing knot sequence with n + 1 knots,
s0 ≤ s1 ≤ . . . ≤ sn ,
(61)
where we assume that at most m consecutive knot coincide: si < si+m . Each m–tuple of
neighbouring knots shall be associated with a control point,
dk ∼ (sk , . . . , sk+m−1),
k = 0, . . . , n − m + 1.
(62)
These control points define in each non-empty interval
[sj , sj+1],
j = m − 1, . . . , n − m,
(63)
a polynomial curve of degree m, with control points dj−m+1 , . . . , dj+1 (with respect to the
knots sj−m+1 , . . . , sj+m) The so (piecewise) defined curve will be called B-spline curve
(more precisely: spline curve B-spline representation) of the given knots and control points.
The control points form the de Boor control polygon of the curve.
Remark 4.7
1. The notation B(asis) spline can be explained with the fact, that such
a curve may also be described in the form
p(t) =
n−m+1
X
Nk (t) dk .
(64)
k=0
The basis functions Nk (t) are the so-called B-splines of degree m (=order m + 1).
2. Often the order m + 1 is used instead of the polynomials degree m.
3. Choosing the knots in the following way
(s0 , . . . , s2m−1 ) = (a, a, . . . , a, b, b, . . . , b),
| {z } | {z }
m
(65)
m
one obtains a Bézier curve with the Bézier control points d0 , . . . , dm .
4. Often the knot vector is chosen such that the boundary knots have multiplicity m.
5. For the calculation of a point on the curve p(t) one has to locate first the interval
of the knot vector that contains the parameter value t and apply the algorithm of de
Boor to the associated knots and control points
For instance for si ≤ t ≤ si+1 , de Boor’s algorithm uses the m + 1 control points
di+1−m ∼ f (si+1−m , . . . si )
..
.
(66)
di+1 ∼ f (si+1 , . . . si+m+1 ).
For
t ∈ [sm−1 , sn−m+1 ]
this is possible.
(67)
25
4.5 Knot insertion
Properties of B-spline curves
Theorem 4.8 B-spline curves possess the following properties:
1. The curve is m − r times differentiable in each knot of multiplicity r, i.e. C m−r .
2. The B-spline curve is contained in the convex hull of its control points. The representation of a B-spline curve via its control polygon is affine invariant.
3. If the boundary knots have multiplicity m, the first/last l control points define the
first l − 1 derivatives in the boundary points of the curve(l = 0, . . . , m).
4. In each interval [sj , sj+1 ] of the knot vector the B-spline curve is a polynomial curve.
5. Each control point dj influences at most m + 1 segments of the B-spline curve. The
shape of the curve can therefor be modified locally.
Remark 4.9
1. The proof of the first statement follows directly from theorem4.5. The
proof of the second statement follows from de Boor’s algorithm.
2. In the case of m–fold boundary knots the B-spline curve acts on the boundary ”‘like
a Bézier curve.”’
4.5
Knot insertion
Knot insertion is a powerful tool for the modification of spline curves.
Let a B-spline curve of degree m with knots s0 , . . . , sn and control points d0 , . . . , dn−m+1
be given, see definition 4.1. We are looking for a representation of this curve as spline
curve with respect to the modified knot vector
s0 , . . . , si , ŝ, si+1 , . . . , sn ,
(68)
where we assume si ≤ ŝ ≤ si+1 .
Theorem 4.10 The control points d∗0 , . . . , dn−m+2 with respect to the new knot vector can
be derived from the old control points via the linear combinations
d∗j = αj dj + (1 − αj )dj−1
with




1
for j ≤ i − m + 1
ŝ − sj−1
for i − m + 2 ≤ j ≤ i + 1
αj =
sj+m−1 − sj−1



0
for j ≥ i + 2
Proof. The control points d∗i are identified with the following values of the blossom:
(69)
(70)
26
4 B-SPLINE–CURVES
1. For j + m − 1 ≤ i it holds that
d∗j = f (sj , . . . , sj+m−1 ) = dj
(71)
2. For i − m + 2 ≤ j ≤ i + 1 holds
d∗j = f (sj , . . . , si , ŝ, si+1 , . . . , sj+m−2)
ŝ − sj−1
sj+m−1 − ŝ
f (sj , . . . , sj+m−1) +
f (sj−1, . . . , sj+m−2 ) (72)
sj+m−1 − sj−1
sj+m−1 − sj−1
sj+m−1 − ŝ
ŝ − sj−1
dj +
dj−1 ,
=
sj+m−1 − sj−1
sj+m−1 − sj−1
=
where the knot sequence sk , sk−1 is interpreted as empty.
3. For j − 1 ≥ i + 1 holds
d∗j = f (sj−1, . . . , sj+m−2 ) = dj−1
(73)
The combination of these three cases proofs the statement.
Example 4.11 As an example we consider the insertion of a knot for a cubic B-spline
curve, i.e. m = 3 and i = 4, see Figure 16. One can see the old and new control points and
7’
6
4’
6’
5’
5
3’
4’
4
c
3’
3
b
2’
a
c
2
5
6’
6
1
1’
1
5’
a
2’
2
4
b
3
7’
1’
Figure 16: Inserting a knot in a cubic B-spline curve.
the ratios / linear combinations (a,b,c). The control points that are not used during the
knot insertion procedure are displayed in green and red. If the new knot coincides with an
already existing knot, only two new control points are to be computed, as the other ratio
degenerates to 1:0.
27
4.6 Basis functions: B-splines
Remark 4.12 There exists a close relation between the computation of a curve point, the
algorithm of de Boor and the insertion of a knot:
1. The m new control points that are generated through the knot insertion process are
the same as in the first step of the algorithm of de Boor.
2. If the inserted knot has already multiplicity r < m in the knot vector, (before insertion), only m − r new control points are generated. Those are the same as in the
r + 1-th generation of the de Boor algorithm.
3. The computation of a curve point can therefor be interpreted as an m time knot
insertion.
4. The weights that occur during the knot insertion process are all non-negative. If the
multiplicity of a knot reaches the degree m of the curve, no further knot insertions
are possible (denominator of the weights are zero)
Example 4.13 As an example we consider a 3-fold knot insertion in a cubic B-spline
curve, see Figure 17.
4
e
4’’ 5’’’ 5’’
4’’’ f 6’’’
5’
6’’
d
3’
3’’
5
5’
4
b 4’
3
6
5’’
c
4’
c
a
e 5’’’
4’’
f
2
3
b
3’
d
5
2’
6’
6
1
2
a
1’
7’
1
Figure 17: Inserting a knot 3 times in a cubic B-spline curve; m = 3, i = 4. Only
the new control points and the needed ratios / linear combinations are shown.
4.6
Basis functions: B-splines
The so-called B(asis)-splines form a basis of the space of spline functions over a given knot
vector. A spline curve can therefor be represented in the form (64).
28
4 B-SPLINE–CURVES
We consider a B-spline curve for a given knot vector with the scalar coefficients (control
points)
1, i = k
k = 0, . . . , n − m + 1
(74)
dk = δik =
0, i 6= k
This curve is defined for the parameter interval s ∈ [sm−1 , sn−m+1 ].
Definition 4.14 The so obtained spline function is called the B-spline Ni which is associated with the knotssi−1 , . . . , si+m .
Example 4.15 Figure 18 shows the B-splines of degree 3 with respect to two different
knot sequences. The knots at the boundary have multiplicity 4.
1
1
0.8
0.8
0.6
0.6
0.4
0.4
0.2
0.2
0
1
2
t
3
4
5
0
1
2
t
3
4
5
B-Splines mit verschiedenen Knoten
Figure 18: Cubic B-Splines.
Remark 4.16
1. The algorithm of de Boor reveals the fact that the B-spline Ni depends only on the knots si−1 , . . . , si+m .
2. The B-spline N0 is defined via the knots s−1 , . . . , sm , where s−1 can be chosen arbitrarily. The value of Ni (t) for t ≥ sm−1 does not depend on th choice of s−1 . A
similar phenomenon occurs for the last B-spline.
3. To overcome this ambiguity, the boundary knots are often defined with multiplicity
m + 1 (instead of m). The additional knots do not have any influence on the shape
of the resulting curve.
4. More general: The B-spline Ni has the knots si−1 , . . . , si+m . The value of Ni (t) for
t ≥ si+m−1 does not depend on the choice of si−1 , and the value for t ≤ si does not
depend on si+m , see Figure 4.
29
4.6 Basis functions: B-splines
1
0.7
0.6
0.8
0.5
0.6
0.4
0.3
0.4
0.2
0.2
0.1
0
1
2
3
4
5
0
1
t
2
3
4
5
t
Figure 19: Cubic B–splines with the knots (1, 2, 3, 4, 5) and (0, 2, 3, 4, 5)
(left) and right (1, 4, 4, 4, 5) and (0, 4, 4, 4, 5) . For t > 4 both B–splines
coincide.
5. Since de Boors algorithm depends linearly on the control points, condition (64)
holds.
Remark 4.17 The polynomial segments of a B-spline can be created e.g. with Maple, see
20.
Properties of B–splines
Theorem 4.18
1. The B-splines have a compact support. It holds that
Ni (t) = 0 if t ∈
/ [si−1 , . . . , si+m ].
(75)
2. The B-splines form a partition of unity,
n−m+1
X
Ni (t) = 1 for
t ∈ [sm−1 , . . . , sn−m+1 ].
(76)
i=0
3. The B-splines are non-negative, Ni (t) ≥ 0.
4. If a knot has multiplicity r, the B-spline is C m−r at this position.
Recursion for B–splines.
The B-splines can also be defined via a recursion that generalizes the recursive definition
of the Bernstein polynomials (Lemma 2.4).
30
4 B-SPLINE–CURVES
> readlib(bspline);
proc(d, v, knots)
...
end
> bspline(3,t,[0,0,2,3,4]);
{
0
{
13 3
2
{
- -- t + 1/2 t
{
72
{
2
23
3
{ 8/9 - 1/6 t - 7/12 (t - 2) + -- (t - 2)
{
72
{
2
3
{ 5/4 - 3/8 t + 3/8 (t - 3) - 1/8 (t - 3)
{
{
0
t < 0
t < 2
t < 3
t < 4
4 <= t
Figure 20: Computation of the polynomial segments of a cubic b-spline
with Maple.
Theorem 4.19 The B-splines Nim of degree m over the knot vector T = (t0 , . . . , tn ) fulfill
the recursion
1 if ti−1 ≤ t < ti
0
, i = 1, . . . , n,
(77)
Ni (t) :=
0 otherwise
and for r = 1, . . . , m
Nir (t) :=
t − ti−1
ti+r − t r−1
Nir−1 (t) +
N (t),
ti+r−1 − ti−1
ti+r − ti i+1
i = 1, . . . , n − r.
(78)
Example 4.20 Figure 21 shows the B-splines of degree 0,1,2,3 defined via the recursion
in (78). The resulting B-spline Nid , which is C d−1 , is defined as the sum of two functions
which are (each on their own) only C d−2 !
Proof. See for example, Carl de Boor: A practical guide to Splines
4.7
Extension
In the final section of this chapter we investigate the derivatives of a B-spline curve and
treat the conversion from a B-spline segment to a Bézier representation.
Bézier–segments of a B-spline curve
Remark 4.21 Via knot insertion one can construct the Bézier–control points of the segments of a B-spline curve. In order to do so the multiplicity of each knot is raised till it
31
4.7 Extension
N10 (t) and N20 (t) (rot)
t−t0
N 0 (t)
t1 −t0 1
and
t2 −t
N 0 (t)
t2 −t1 2
N11 (t) and N21 (t) (rot)
t−t0
N 1 (t)
t2 −t0 1
and
t3 −t
N 1 (t)
t3 −t1 2
N12 (t) and N22 (t) (rot)
t−t0
N 2 (t)
t3 −t0 1
and
t4 −t
N 2 (t)
t4 −t1 2
N03 (t)
Figure 21: Recursive definition of the B-splines of degree m = 0, . . . , 3
for a given knot sequence. Combining two B-splines of degree d − 1 gives
a B-spline of degreed.
reaches the polynomials degree m. For low degrees Figure 22 shows the geometric construction. In the situation of equidistant knots the new points are obtained by splitting
the edges of the control polygon in equal lengths.
In literature this technique is often referred to as Algorithm of (W.) Boehm.
Derivatives of a B-spline curve
Theorem 4.22 We consider the B-spline curve p(t) of degree m with knots s0 , . . . , sn and
control points d0 , . . . , dn−m+1 . We assume that the inner knots have at most multiplicity
m. The derivative p′ (t) is a B–spline curve of degree m − 1 with knots s1 , . . . , sn−1 and
control points
m
(di+1 − di ); i = 0, . . . , n − m.
(79)
d′i =
si+m − si
32
4 B-SPLINE–CURVES
a) m = 2
[2,2]
[1,2]
[2,3]
[3,3]
[1,1]
[3,4]
[0,1]
b) m = 3
[1,2,3]
[2,2,3] [2,3,3]
[3,3,4]
[2,2,2]
[1,1,2]
[2,3,4]
[3,3,3]
[3,4,4]
[4,4,4]
[0,1,2]
[3,4,5]
[4,4,5]
]
,5
,4
,3
[2
]
,3,
4,4
]
[3,3,4,5]
]
4,4
[3
,3]
,3,4
[3,3
[3,
[2,
3,3
[1,2,3,3]
3,3
,3]
[2
[1,2,3,4]
[2
,3
,3
,3
,4
,4
,4
]
c) m = 4
]
[4,5,6]
,4,
[3,4,4,5]
[3
]
4,4
4,4,
[
[3,4,5,5]
]
[4,4,4,5
[0,1,2,3]
[4
6]
5,
,
,4
6]
5,
[4
,
,5
[5
6]
5,
,
,4
[3
[4,4,5,5]
[4,5
,5,5
]
[5,
5,5
,5]
[5,6,7,8]
,
,5
6]
5,
[5,5,6,7]
[4
,7
,6
,5
]
Figure 22: Construction of the Bézier segments of a spline curve. The B-spline control
polygon is displayed in black and the Bézier–control polygons in red and green. The
numbers in brackets are the argument lists of the blossom. For c) (degree 4) the points
[3,3,4,4] and [4,4,5,5] can be obtained in two different fashions. Therefor they lie on two
different lines.
33
Proof. Omitted.
Remark 4.23 In the special case
(a, . . . , a, b, . . . , b )
| {z } | {z }
m–fach m–fach
(80)
we obtain the formula from Lemma 2.7 for the derivatives of a Bézier curve.
5
Interpolation and Approximation
In this section we will disuss some techniques for generating curves (and surfaces) from
point data.
5.1
Problem setting
Let the points (pi )i=0,...,N be given. They shall either form a polygon or have a ”‘surfacelike structure”’. We are looking for a spline curve/surface that approximates those points,
i.e.
x(ti ) ≈ pi , or x(ui , vi ) ≈ pi .
(81)
for certain parameter values ti or (ui , vi ). A typical data set is shown in Figure 23.
Nowadays, such data sets can be generated with the help from optical or mechanical
20
10
0
-10
-20
-30
-40
260
280
300
900
920
320
940
960
340
980
1000
360
1020
380
1040
400
1060
1080
Figure 23: Example of a data set (16.500 points).
scanners.
5.2
Parametriation of point data
In order to compute the approximating/interpolating curve/surface one has to assign in a
first step to each data point a certain parameter value. (ti or (ui , vi )).
34
5 INTERPOLATION AND APPROXIMATION
Curves
If the data form a polygon that shall be describe through a curve, the ti can be estimated
from the distances between neighbouring points.
Let [a, b] be the parameter interval of a spline curve. A family of possible parametrizations
is of the form
tj = a +
j
X
∆ti with
i=0
∆ti = ti+1 − ti =
(b − a) ||pi+1 − pi ||λ
,
N
−1
X
||pj+1 − pj ||λ
i = 0, . . . , N − 1.
(82)
j=0
where λ is a constant that can be chosen by the user.
Special cases are
a) λ = 0: die uniform parametrization, ∆ti = constant;
b) (λ = 1): die chordal parametrization (approximation of the arc length of the polygon), and
c) (λ = 1/2): die zentripetal parametrization.
Surfaces
In order to parametrize surface-like data, those have to be projected in a suitable way into
the plane R2 . A simple method is the orthogonal projection of the data onto a regression
surface
~ = 0}
E = {x | (x − p̂)⊤ N
(83)
~ is the (normalized) normal vector of the plane and p̂ a point.
see Figure 24. Here, N
This regression plane can then be used to derive the parameter values (ui , vi ).
Figure 24: Parametrization via a projection onto a regression surface.
35
5.3 Interpolation with B–spline curves
Theorem 5.1 For the plane that minimizes the squares of the distances to the data points,
i.e.
X
~ p̄) =
~ 2 → Min,
f (N,
[(pi − p̄)⊤ N]
(84)
i
~ is the Eigen vector which is associated with the smallest Eigen value
the normal vector N
P
of the 3 × 3 matrix Q = i (pi − p̄)(pi − p̄)⊤ and the point p̄ is the barycenter
1 X
p̄ =
pi
(85)
N +1 i
of the point cloud.
Proof. Omitted.
Remark 5.2 This technique (projection onto a plane) does not work if the underlying
surface cannot be described as the graph of a function. In those situation one might
project the data onto different surfaces such as cones or cylinders, or, the data set can be
split into several parts.
5.3
Interpolation with B–spline curves
We use a B-spline curve of degree n with the knots s0 , . . . , sn and control points
d0 , . . . , dn−m+1 ,
n−m+1
X
Nk (t)dk .
(86)
x(t) =
k=0
The interpolation conditions
x(ti ) =
n−m+1
X
Nk (ti )dk = pi
(87)
k=0
lead to a linear system of equations. For N = n − m + 1 the number of equations and the
number of unknowns agree.
Theorem 5.3 (Schoenberg-Whitney) The linear system possesses a unique solution if and
only if
Ni (ti ) 6= 0.
(88)
Proof. Siehe J. Schoenberg und A. Whitney, “On Pólya frequency functions, III. The
positivity of translation determinants with an application to the interpolation problem by
spline curves.” Trans. Amer. Math. Soc. 74, (1953). 246–259.
Remark 5.4
1. The coefficient matrix of the linear system has a band structure, where
the band width depends on the polynomial degree of the splines. For banded matrices
exists a range of efficient solution techniques.
2. The choice of the parameter values has an important influence on the shape of the
interpolating curve, see Figure 25.
36
5 INTERPOLATION AND APPROXIMATION
Figure 25: Interpolation of six points with a cubic spline curve with
natural boundary conditions (x′′ (t0 ) = x′′ (tN ) = 0) and uniform (left),
chordal (middle) and centripetal (right) parametrization.
5.4
Approximation with B–spline curves
In general the number of data points exceeds the number of control points (≈ degrees of
freedom)
n − m + 1 << N,
(89)
and interpolation techniques cannot be used.
Minimizing Squared distances
Instead, one can approximate the given points with a curve. Probably the most commonly
used technique is to minimize the squares of the error distances,
F =
N
X
i=0
kx(ti ) − pi k2 =
N
X
i=0
k
n−m+1
X
Nk (ti )dk − pi k2 → Min.
k=0
This leads to a linear system
XX
X
Nk (ti )Nj (ti )dk =
Nj (ti )pi ,
k
i
(90)
j = 0, . . . , n − m + 1,
(91)
i
which can easily be solved. Since the B-splines have a compact support, the matrix has
again a banded structure.
37
5.4 Approximation with B–spline curves
Theorem 5.5 The system (91) has a unique solution if condition 5.3 is fulfilled for a
subset of the parameter values ti .
Parameter correction
In order to enhance the results of the approximation, one can optimize the parameter
values as well. In a first step an approximation of the data is computed and then one finds
the parameter values on this curve that correspond to the points that are closest to the
data points. In a second step, those parameter values can be used to compute a (better?)
approximation of the data set.
The necessary parameter correction ∆ti can be found via a first order Taylor expansion of
the curve
(pi − x(ti )) · ẋ(ti )
∆ti = −
,
(92)
ẋ(ti ) · ẋ(ti )
see Figure 26.
pi
x(t i ) + ∆ t i x’(t i )
x(t i )
Figure 26: Parameter correktion.
At the end points of the polygon this technique has to be modified. Otherwise, the parameter values may “leave” the parameter interval. A simple strategy is to fix the boundary
points at the first and the last parameter values of the interval and keep them fixed through
the approximation process.
Additionally, the ordering of the points shall be kept unchanged.
Global optimization
More general, one can interprete the sum of the squared errorsF (see (90)) as function of
the control points dk and of the parameter values ti and optimize for all unknowns at once:
arg min F.
dj
ti ,dj
(93)
38
5 INTERPOLATION AND APPROXIMATION
This non-linear problem can be solved for instance with Newton’s method (if a suitable
initial solution is available!). The minimum of F is found via the (iterative) solution of
the non-linear system ∇F = ~0 (where the gradient has to be computed with respect fo all
unknowns).
In each step the equation system is of the shape (here d = 2):


∆t0
..


.





 ∆tN 

 


D
C1 C2 

d0,1
~
u





..
 =  ~v1 
(94)


.




⊤

~v2
C1
M1 0   dn−m+1,1 



 d0,2

C2⊤
0 M2


..


.
dn−m+1,2
The matrices D, Ci , Mi are of the dimension N × N, N × n − m + 2 and (n − m + 2)2 ,
where usually N >> n − m + 2.
For an efficient numerical treatment the following fact should be taken into account
The matrix D is a diagonal matrix, as the mixed derivatives with respect to the
parameter values cancel out.
Example 5.6 40 points on a circular arc are to by approximated by a quadratic Bézier
curve. The initial parametrization was chosen uniformelly (see Figure 27).
Comparision between parameter correction and global optimization
The global optimization converges only if a suitable initial values is available. However the
convergence is fast.
The parameter correction is more robust, as in each step the obejctive function decreases.
The convergence of the parameter correction is in general slower than the global optimization
The numerical effort for both method is comparable. Although the matrix is bigger for the
global optimization, it can be solved quite efficiently due to its diagonal structure.
schnell
“Variational Design”
In order to influence the shape of the shape of the curve, additional constraints are take
into account. Most commonly, certain (quadratic) “Energy” functionals are used
Z b
dk
(95)
|| k x(t)||2 dt,
dt
a
39
5.4 Approximation with B–spline curves
0.071639
0.042130
0.031310
2
2
2
1
1
1
0
0
0
-1
-1
-1
-2
-2
-1
0
1
2
3
4
-2
-1
0
1
2
3
4
-1
0.024409
2
2
1
1
(· · ·)
3
4
3
4
-1
-2
-2
-1
0
1
2
3
4
-1
0.071639
0
1
2
3
4
0.004461
0.000364
2
2
2
1
1
1
0
0
0
-1
-1
-1
-2
-2
-2
1
2
0
-1
0
1
0.000361
0
-1
0
2
3
4
-1
0
1
2
3
0.000338
0
1
2
0.000338
2
2
1
1
0
0
-1
-1
-2
-1
-1
4
-2
0
1
2
3
4
-1
0
1
2
3
4
Figure 27: Approximation of point data with parameter correction (top; solution after
1,2,3,4 and 39 iterations) and global optimization with Newton’s–method (bottom;
initial solution and after 2,3,4 and 5 iterationen). We displayed the curve, its control
polygon a the given points (+), the associated curve points x(ti ) (◦), and the error vectors
(magnified by a factor of 100).
40
6 IMPLICIT DESCRIPTIONS
where k = 1, 2, 3, as those can be minimized easily. Those functionals can be seen as an
approximation of certain geometric invariants, as for example the bending energy
Z b
κ2 ds.
(96)
a
Figures 5.4 and 5.4 show several curves that are interpolating 4 points with different energyfunctionals.
6
Implicit descriptions
Given a parametric form, each coordinate of a curve/surface is described explicitly by a
function that depends on one or two parameters. In contrast, in an implicit representation
the curve or surface is the zero-set of a bi-/trivariate function.
Both descriptions are very well suited for a number of applications. In the following we will
mention some of them in the curve case, but most of them extend directly to the spatial
situation.
• For tracing a parametric curve one simply plugs a number of parameter values into
the defining functions. This straight forward evaluation can be done very fast for a
huge number of points.
Plotting an implicit curve, a set of points that solve the defining function has to be
identified. Obviously, this is not so easy.
• Closely related to this problem is the following question. Given a curve and a point,
one is interested whether the point lies on the curve or not. In the parametric form
this is equivalent to the solution of a system of equations. If, on the other hand,
the implicit representation is available, one has only to evaluate the equation at this
point. Points that lie on the curve, fulfill the equation. Otherwise, the function value
is positive or negative depending on the side of the curve where the point lies.
• For some fundamental algorithms, such as footpoint computations, initial values are
required for parametric representations. These may be difficult to be obtained. In
the implicit situation this is not the case.
• Small perturbations in the data have different impacts on parametric and implicit
curves. Given a parametric curve in BB–representation, the displacement can easily
be bounded. For implicit curves even small perturbations may entail essential changes
of the shape or the topology.
• Directly connected to this topic is the fact that implicit curves may consist of several
branches. This leads to important problems when implicit curves are used for curve
fitting. Additional branches or singular points may be created in the domain of
interest. However, using a parametric curve for fitting, an auxiliary parameterization
of the data is needed.
41
4
4
4
3
3
3
2
2
2
1
1
1
0
0
0
-1
-1
0
1
2
3
4
-1
0
1
Kruemmung
2
3
4
0
15
15
10
10
10
5
5
5
0
0
0,2
0,4
0,6
0,8
1
t
-5
2
3
4
Kruemmung
15
0
1
Kruemmung
0
0
0,4
0,2
0,6
0,8
1
t
-5
0
0,2
0,4
-10
-10
-10
-15
-15
-15
0,6
0,8
1
t
-5
Figure 28: Interpolation of four points with parameter values (0, 0.3, 0.5,
1) with a cubic curve (left) and two quintic curves (middle and right).
For the quintic curves we minimized additionally (95) for k = 1 (middle)
and k = 2 (right).
4
4
4
3
3
3
2
2
2
1
1
1
0
0
0
-1
-1
0
1
2
3
4
-1
0
1
2
3
4
0
1
2
Figure 29: As above, the degree of the middle and right curve is 7.
3
4
42
6 IMPLICIT DESCRIPTIONS
As one can see, both methods have some potential benefits but at the same time they
suffer from weaknesses in other fields. However, there exist an important tool that helps to
exploit the strengths of both forms: the conversion from one representation to the other.
While the transformation from parametric to implicit (implicitization) is always possible,
this is not true for the inverse (parameterization). Many exact methods for implicitizing
parametric curves have been developed.
In recent years, more and more attention was paid to approximative techniques due to
the following reasons. Exact methods are computational very expensive. Furthermore, for
implicit representations one has to handle a huge amount of data. For example a bicubic
Bézier patch (consisting of 16 control points) can be represented exactly by a degree
18 polynomial which is equipped with 1330 scalar coefficients.
But often, e.g. for industrial purposes, it might be sufficient to obtain an implicit representation that is only computed up to a certain accuracy. Consequently, using approximative
techniques, computational resources are saved. Additionally, many of the exact coefficients
that are close to zero, can be neglected in the approximative representation. This may lead
to a substantial reduction of the data volume.
6.1
Implicit curves
For implicitly defined curves we shall use the following representation:
Definition 6.1 An implicit, planar curve segement F is given in a certain domain Ω ⊂ R2
by the zero-set of a bivariate function f : R2 → R:
F := {x|x ∈ Ω ⊂ R2 ∧ f (x) = 0}.
(97)
Of course, the polynomial in definition 6.1 can be described in different basis. One choice
might be the following
f (x) :=
X
bijk Bijk (u, v, w)
i+j+k=n
n!
with Bijk (u, v, w) := i!j!k!
ui v j w k , i + j + k = n. The triples (u, v, w) are the barycentric
coordinates of the point x with respect to a non-degenerated domain triangle ∆ABC ⊂ R2 .
The control points bijk are scalar-valued and they form the control net of the polynomial.
Definition 6.2 Let A = (a1 , a2 ), B = (b1 , b2 ), C = (c1 , c2 ), be three non-colinear points
in R2 . Then, each other point X = (x1 , x2 ) can be described
X = u A + v B + w C,
mit
u + v + w = 1,
(98)
43
6.2 Implicitization of parametric curves
1.0
1.0
1.0
0.5
0.5
0.5
0.0
0.0
-1.0
-0.5
-0.5
0.0
-1.0
-1.0
-0.5
0.5
0.0
y
0.5
1.0
1.0
f (x, y) = xy
x
-1.0
-0.5
-0.5
0.0
-1.0
-1.0
-0.5
x
0.5
0.0
y
0.5
1.0
0.0
-1.0
-0.5
-1.0
-1.0
-0.5
0.0
-0.5
1.0
f (x, y) = xy − 0.01
x
0.5
0.0
y
0.5
1.0
1.0
f (x, y) = xy + 0.01
Figure 30: Zero sets of three different functions.
where

1
det  1
1

u=
1

det 1
1
x1
b1
c1
a1
b1
c1


1
x2
det  1
b2 
1
c2
, v =

a2
1


b2
det 1
c2
1
a1
x1
c1
a1
b1
c1


a2
1
x2 
det  1
c2
1
, w =

a2
1


b2
det 1
c2
1
a1
b1
x1
a1
b1
c1

a2
b2 
x2
.
a2
b2 
c2
(99)
The triple (u, v, w) form the baryzentric coordinates of the points X with respect to the
triangle ABC.
Example 6.3 (a) The zero set of the polynomial f (x, y) = x2 + y 2 − 1 describes the unit
circle.
(b) Figure 30 shows three implicit curves. Note, that the curves differ quite a lot although,
the defining polynomials are quite similar.
Remark 6.4 A parametric description of (a segment) of the unit circle would by x =
1−t2
2t
( 1+t
2 , 1+t2 ). This can easily be verifed as each point on the parametric curve fulfills the
equation f (x, y) = x2 + y 2 − 1 = 0.
6.2
Implicitization of parametric curves
This brings us directly to the problem that we have to solve if we want to implicitize a
parametric curve p(t):
Find a non-trivial polynomial q(x) : R2 → R such that q(p(t)) = 0
Remark 6.5
• A 2D parametric curve p(t) of degree n in the variable t can be expressed implicitly as a degree n polynomial q(x, y), with q(p(t)) = 0
• A 3D rational parametric surface p(s, t) of degrees (n1 , n2 ) in the variables (s, t) can
be expressed implicitly as a degree 2n1 n2 polynomial q(x, y, z), with q(p(s, t)) = 0.
44
6 IMPLICIT DESCRIPTIONS
Obviously, for practical applications it may suffer to compute only an approxmiate implicitization of the parametric entity. In the following we will discuss a technique that
makes use of the properties of the Bernstein polynomials. Plugging the parametric curve
p(t) into the polynomial q(x) with unknown coefficients yields
q(p(t)) = (Db)T α(t) = 0
(100)
The vector b is holding the unknown coefficients, α(t) holds the combination of all basis
functions and D contains (products of) the coefficients from the parametric curve. If α(t)
describes a Bernstein basis, thatn kα(t)k2 ≤ 1 and we can write
|q(p(t))| = |(Db)T α(t)| ≤ kDbk2
(101)
Of course, if the right hand side (101) equals zero, then we found an implicit description
of the parametric curve. This is true if b is an Eigen vector of D that is associated with
the Eigen value 0. But still, if kDbk is small it seems to be reasonable to consider q(x) as
a good implicitization.
Summing up, the implicitization can be reduced to a singular value decomposition of a
matrix. If the smalles Eigen value is zero, the associated Eigen vector holds the coefficients of the exact implicit equation. Otherwise, one can choose the Eigen vector which is
associated with the smallest Eigen value as an good approximation of the exact implicit
equation. This can be justified by the following result:
Theorem 6.6 Let σ1 be the smallest singluar value of D where D is defined as before,
then
min max |q(p(t))| ≤ σ1
kbk2 =1 t∈Ω
Similar results can be formulated for the implicitization of surfaces.
45
CONTENTS
Contents
1 Introduction
2
2 Bézier curves
2.1 Traditional representations of polynomial curves
Polynomial curves . . . . . . . . . . . . . . . . .
Standard– or monomial description . . . . . . .
Lagrange representation . . . . . . . . . . . . .
Hermite representation . . . . . . . . . . . . . .
2.2 Bézier curves . . . . . . . . . . . . . . . . . . .
Bernstein polynomials . . . . . . . . . . . . . .
Recursion of the Bernstein polynomials . . . . .
Derivatives of the Bernstein polynomials . . . .
Further properties of the Bernstein polynomials
Derivatives of a Bézier curve . . . . . . . . . . .
Derivatives at the boundary . . . . . . . . . . .
2.3 The algorithm of de Casteljau . . . . . . . . . .
Geometric Interpretation . . . . . . . . . . . . .
Further properties of Bézier curves . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3
3
3
3
3
4
5
5
6
6
6
7
7
8
8
9
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
3 Blossoming
3.1 The blossom of a polynomial . . . . . . . . . . . . . . .
The ”‘Blossoming–principle”’ . . . . . . . . . . . . . .
3.2 Bézier curves . . . . . . . . . . . . . . . . . . . . . . .
Blossoming and the algorithm of de Casteljau . . . . .
3.3 Subdivision of Bézier curves . . . . . . . . . . . . . . .
De Casteljau–Extrapolation . . . . . . . . . . . . . . .
Convergence under subdivision . . . . . . . . . . . . . .
3.4 Degree elevation . . . . . . . . . . . . . . . . . . . . . .
Comparison between subdivision and degree elevation.
3.5 Derivatives and blossoming . . . . . . . . . . . . . . . .
Computation of a derivative . . . . . . . . . . . . . . .
Contact condition . . . . . . . . . . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
10
10
11
12
12
13
13
14
15
15
17
17
17
4 B-spline–curves
4.1 Draw backs of polynomial curves .
The solution: . . . . . . . . . . . .
4.2 Spline curves . . . . . . . . . . . .
Basis representation . . . . . . . . .
4.3 de Boor’s algorithm . . . . . . . . .
De Boor control points of a segment
Evaluation of a blossom . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
18
18
18
19
20
20
20
21
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
46
CONTENTS
.
.
.
.
.
.
.
.
.
.
.
.
21
22
23
24
25
25
27
29
29
30
30
31
.
.
.
.
.
.
.
.
.
.
.
33
33
33
34
34
35
36
36
37
37
38
38
6 Implicit descriptions
6.1 Implicit curves . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
6.2 Implicitization of parametric curves . . . . . . . . . . . . . . . . . . . . . .
40
42
43
4.4
4.5
4.6
4.7
Computation of a curve point . . .
Construction of spline curves . . . .
Two segments . . . . . . . . . . . .
Several segments . . . . . . . . . .
Properties of B-spline curves . . . .
Knot insertion . . . . . . . . . . . .
Basis functions: B-splines . . . . .
Properties of B–splines . . . . . . .
Recursion for B–splines. . . . . . .
Extension . . . . . . . . . . . . . .
Bézier–segments of a B-spline curve
Derivatives of a B-spline curve . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
5 Interpolation and Approximation
5.1 Problem setting . . . . . . . . . . . . . . .
5.2 Parametriation of point data . . . . . . . .
Curves . . . . . . . . . . . . . . . . . . . .
Surfaces . . . . . . . . . . . . . . . . . . .
5.3 Interpolation with B–spline curves . . . . .
5.4 Approximation with B–spline curves . . .
Minimizing Squared distances . . . . . . .
Parameter correction . . . . . . . . . . . .
Global optimization . . . . . . . . . . . . .
Comparision between parameter correction
“Variational Design” . . . . . . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
. . . . . .
and global
. . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
. . . . . . . .
optimization
. . . . . . . .
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.
.