Professional Documents
Culture Documents
Design of curves
Alexander Lauser
Ferienakademie Sarntal 2004
Agenda
Motivation
Polynomial Interpolation
Bézier curves
Splines
Smoothness
B-Splines
Rational Bézier curves
NURBS
Why designing curves?
Many technological applications
Design of products (e.g. CAD)
Calculation of the path for a robot
Design of fonts
Sum to union
n
Bi t 1, t
i 0
Bézier – mathematical
Definition of Bézier curve:
n
n
x t : bi Bi t with t 0,1
i 0
n Bin 1
1
t Bin 1
t
Bézier – derivation
Derivation of Bézier
n n n
d d n d n n 1 n 1
x t bi B t i
bi Bi t n b i Bi 1
t Bi t
dt dt i 0 i 0 dt i 0
n n 1
n 1 n 1 n 1 n 1
n bi B i 1
t n bi Bi t with B 1
t 0 Bn t 0
i 1 i 0
n 1 n 1
n 1 n 1
n bi 1 Bi t n b i Bi t Indexshift
i 0 i 0
n 1
n 1
n bi 1
bi Bi t Joined sums
i 0
Bézier – construction
Repeated linear interpolation
0,5 0,5
P1
0,5 P2
0,5
t = 0,5
P0 P3
Bézier – characteristics
Good controllability
Interpolates endpoints (s(0) = b0, s(1) = b1)
First two points determine the tangent vector at
the start: x 0 n b 1 b0
Last two points determine the tangent vector at
the end: x 1 n b b
n n 1
Good locality
Local changes only have local impact
Anyway changes are global
Bézier – characteristics
Lies within the convex closure of the control
points
Useful for collision detection
Invariant under affine transformation
You can rotate, translate and scale the control
polygon
Complex shape of model implies a great
amount of control points
This means the degree of the curve is high
So the evaluation of such a curve is slow
Splines
Modelling segmental
Splines
Piecewise polynomial segments
Modelling the curve locally by a segment
The segments are joined to get the global curve
Name derives from shipbuilding
Splines are stripes of metal fixed at several points.
They have the same smoothness as cubic B-Splines
Global parameter u and for each segment si a
local parameter t
Splines – parametrisation
Globally parametrised over a sequence
of nodes ui
Each segment si is locally parametrised
over [ui, ui+1]
Splines – parametrisation
Uniform splines
Uniformly distributed sequence over range
of global parameter u
Nonuniform splines
Sequence is not uniformly distributed
Segments si „live“ over [ui, ui+1] with
local parameter
t = (u – ui) / (ui+1 – ui–1)
Splines – smoothness
What does smoothness
mean?
Graphically clear: No
sharp bends
Mathematical abstraction: Order of
continuous derivability
Only nodes and the corresponding knot-
points are relevant
others points are infinitely often derivable
Splines – smoothness
C0-continuity
The segments meet at the nodes
C1-continuity
Curve must be continuously derivable after the
global parameter u one time
The „speed“ in respect to global parameter must
be the same in the joint both segments
C2-continuity
Curve must be continuously derivable 2 times
The „acceleration“ must be equal in the joint
Splines – smoothness
C1-continuous Spline
C0-continuous Spline
Splines – smoothness
Geometric smoothness: G1-continuity
In every joint there exists a unique
tangent
I.e. tangent vectors need not be equal in
magnitude, only direction
Doesn‘t take global parametrisation into
account
Splines – smoothness
An example for G1-continuous curve
that is not C1-continuous
1 2
u0 u1 u2
1 1
Splines – smoothness
In general
Cx-continuity Gx-continuity
But not: Gx-Continuity Cx-continuity
Special case: Stationary point
All derivations are zero
Then Cx-continuity Gx-continuity doesn‘t
hold
Splines – smoothness
Linear Interpolation
P2
B-Splines – C1-continuity
C1-continuity at knot bi
Tangent vectors must be equal
Bézier: Tangent vectors in bi
s0 - points from bi-1 to bi
s1 - points from bi to bi+1
This means bi-1, bi and bi+1 must be
collinear
bi-1 bi bi+1
s0
s1
Why this?
B-Splines – C1-continuity
Because we are interested in derivability for
the global parameter
Collinearity says that the „speed“ has the same
direction, but not necessarily magnitude
Mathematical derivation
d d d 1 d u uj
s u t u sj t s j t , with j uj 1 u j,t u ,u u j , uj 1
du du dt j dt j
1 d 1 d
So we have to check s0 1 s1 0
0
dt 1
dt
d
1
bn b n 1 0
bn 1
b n , since s0 1 n bn b n 1
and s 1 0 n bn 1
bn
dt
B-Splines – C1-continuity
Given: Two Bézier curves
How to test C1-continuity
Consider the joint points of the spline and its
direct neighbours
When no joint it isn‘t even C0-continuous
Are they collinear?
No, then the spline is not C1-continuous
Ok, they are collinear
Then check the ratio of the distance from the knot point
neighbours to the knot point. It must be same ratio as of
the corresponding nodes
B-Splines – C2-continuity
C2-continuity at knot bi
Precondition: C1-continuity
Nodes bn-2, bn-1, bn and bn, bn+1, bn+2
must describe a unique global quadratic
Bézier curve
So there must exist a (unique) point d, so
that bn-2, d, bn+2 describe this curve
B-Splines – C2-continuity
The point d must fulfill two conditions
bn 1
1 t bn 2 t d 0
at which t
bn 1
1 t d t bn 2 0 1
u0 u1 u2
B-Splines
How to test for C2-continuity
First of all test for C1-continuity
If it is not, it cannot be C2-continuous
Check for uniqueness of point d
Extrapolate d- from bn-2 and bn-1
Extrapolate d+ from bn+2 and bn+1
d- and d+ must be equal
In Practice specify a tolerance
u0 u1 u2
Quadratic B-Splines
Construction of a C1-continuous quadratic
B-Spline
Different approach
Per definition we want a C1-continuous curve
We do not want to test two segments for
C1-continuity anymore
Given are n+1 control points d0 ,..., dn
spanning the control polygon of the B-Spline
Constructing Bézier control points for a
C1-continuous quadratic B-Spline
Quadratic B-Splines
Construction of Bézier polygon:
b0 : d 0 b2 n 2
: dn b 2 i 1 : d i , i 0, ,n 3
i i 1 1 1
b2 i : b2 i b2 i b2i b b For uniform B-Splines
i 1 i
1
i 1 i
1
2 2i 1
2 2i 1
0,5 b 3 = d2 b6 = d4
0,5 b2
b4
b1 = d1
Quadratic Bézier segments Control polygon
b5 = d3
b7
Cubic B-Splines
b9 = d5 d3
b6
1 1
Left end: b0 : d 0 , b1 : d 1 , b2 : d1 d2
2 2
1 1
Right end: b3 : d n , b3 : d n 1 , b3 : dn dn b4
n 2 n 2 1 n 2 2 2 1
2 2
2 1
b3 i 2 : di 1 di b3
3 3
1 2 b0 = d0
b3i 1: di 1 di d2
3 3
1 1 1 b2
b3 i : b b (Remember C -condition)
2 3i 1 2 3i 1
b1 = d1 B-Spline polygon
Cn-1-smoothness is assured
The support is minimal
That is the range in which it doesn‘t vanish
B-Spline Basis
Ok but how does this look like?
d1
Convex closure
d2
A C1-continuous quadratic B-Spline
B-Splines – characteristics
Modelling of straight lines possible
Even if all local segments are planar,
modelling of true 3D curves is possible
E.g. quadratic B-Splines are planar in each
segment but the global curve may be true 3D
The degree of the global curve doesn‘t
depend on the number of points
Efficient for modelling curves with many points
Rational Bézier curves
z=1 plane
3D Bézier curve
Moving a control point (left) differs heavily from changing its weight (right)
Rational Bézier curves
Because they are invariant under
projection the projected curve can be
modeled further
E.g. a car designer may change the
projected car body
Bézier curves are a subset of the
rational Bézier curves
Special case: Equal weights
NURBS
Questions?
Thank you for paying attention
Sources
Farin, G.:
Kurven und Flächen im Computer Aided Geometric Design
H.-J. Bungartz, M. Griebel, C. Zenger:
Einführung in die Computergraphik
Foley, van Dam, Feiner, Hughes:
Computer Graphics: Principles and Practice - Second Edition in C
http://olli.informatik.uni-oldenburg.de/Grafiti3/grafiti/flow10/page1.html
http://www.cs.berkeley.edu/~sequin/CS284/IMGS/
http://escience.anu.edu.au/lecture/cg/Spline/bSplineFunction.en.html