Professional Documents
Culture Documents
+ + + =
+ + + =
+ + + =
u
d d d
c c c
b b b
a a a
u u u u z u y u x
d u c u b u a u z
d u c u b u a u y
d u c u b u a u x
z y x
z y x
z y x
z y x
z z z z
y y y y
x x x x
Splines
For a 3D spline, we have 3 polynomials:
( ) u p
Defines the variation in x with
distance u along the curve
12 unknowns
4 3D points required
If we have more than 4 points we
require a polynomial of higher
degree
higher degree polynomials are more
difficult to control
they exhibit unwanted wiggles
(oscillations)
Quadratic Cubic Quartic Quintic
Splines
In general we use cubic polynomials for curves in
CG:
minimal ups & downs and faster to compute than
high degree polynomials
lowest degree which allows non-planar curves
(quadratics require 3 points, 3 points always lie in
the same plane)
Splines
Defining the Cubic Spline
Normally we supply 4 points we wish the spline to pass through. These
are
2 endpoints
2 derivatives of the end points
If we have more than 4 points we must employ more than 1 spline
use a piecewise cubic polynomial
for n points, we have (n1)/3 individual cubic segments
without further constraints these will not join smoothly
smooth non-smooth
Curve Continuity Piecewise Curve Segments
To ensure a smooth connection between curve segments we
enforce further continuity constraints
2 types of continuity:
parametric continuity, denoted C
n
where n = degree of
continuity
geometric continuity, denoted G
n
Given a curve such that at point p, 2 segments c
i
(u) and c
i+1
(u)
meet then:
( ) ( )
0
1
1 =
+
=
=
u
n
i
n
u
n
i
n
n
du
u c d
du
u c d
C
( ) ( ) 0 1
1 +
= =
i i
c c p
( ) ( )
0
1
1 =
+
=
u
n
i
n
u
n
i
n
n
du
u c d
du
u c d
G o
differentials are equal differentials are proportional
Geometric continuity
In this case we require only parametric derivative of two curves
to be proportional to each other at their intersection point
If two curve segments joint together there curve has G
0
continuity
If the direction of two segments tangent vectors are equal at
the joint point the curve has G
1
continuity
In CAD G
1
is often required
Mathematically.
2
2
1
2
2
2
1
1
0
1
G
du
Q d
du
P d
G
du
dQ
du
dP
G Q P
n
n
n
=>
=>
=> =
Parametric Continuity
0
th
order
Here curve simply meets
1
st
order
If the tangent vectors of two curves segment are
equal (in direction as well as in magnitude) at the joint
point
2
nd
order
If both the first and second parametric derivatives of
the two curve section are same at the their
intersection
N
th
order
If the nthe derivative are equal at the joint point.
since we want these curves to fit
together reasonably ...
Zero order parametric continuity
First order parametric continuity
Second order parametric continuity
Examples of Continuity
c
0
c
1
c
2
Cubic Parametric Curves
A curve segment p(u) is defined by constraints on
end-points, tangent vectors, and continuity between
curve segments.
Each cubic polynomial has 4 co-efficients, so four
constraints will be needed.
Remember:
This allows us to formulate 4 equations in the 4
unknowns, and then solve for the unknowns.
( )
( )
( )
( ) ( ) ( ) | | | | ( ) C u p . 1
2 3
2 3
2 3
2 3
=
+ + + =
+ + + =
+ + + =
u
d d d
c c c
b b b
a a a
u u u u z u y u x
d u c u b u a u z
d u c u b u a u y
d u c u b u a u x
z y x
z y x
z y x
z y x
z z z z
y y y y
x x x x
Geometry Matrix
To see how the co-efficients can depend on 4 constraints, recall that
a parametric cubic curve is defined by
Rewrite the co-efficient matrix as where
M is a 4x4 basis matrix,
G is a 4-element matrix of geometric contraints, called the geometry
matrix.
The geometric contraints are just the conditions, such as endpoints,
or tangent vectors, that define the curve.
Gx refers to the column vector of just the x components; Gy and
Gz are similarly defined
G or M, or both G and M, differ for each type of curve.
C u = ) p(u
M.G C=
Geometry Matrix
The elements of G and M are constants so the
product G.M.u is just three cubic polynomials in u.
Expanding:
( ) ( ) ( ) ( ) | | | |
= =
4
3
2
1
44 43 42 41
34 33 32 31
24 23 22 21
14 13 12 11
2 3
1
G
G
G
G
m m m m
m m m m
m m m m
m m m m
u u u u z u y u x u p
| |
=
z y x
z y x
z y x
z y x
g g g
g g g
g g g
g g g
m m m m
m m m m
m m m m
m m m m
u u u
4 4 4
3 3 3
2 2 2
1 1 1
44 43 42 41
34 33 32 31
24 23 22 21
14 13 12 11
2 3
1
Blending Functions
We can read this equation in the following way:
The point p(u) is a weighted sum of the columns
of the geometry matrix G, each of which
represents a point or a vector in 3-space
Multiplying out just x(u) gives:
x
x
x
x
g m um m u m u
g m um m u m u
g m um m u m u
g m um m u m u u x
4 44 34 24
2
14
3
3 43 33 23
2
13
3
2 42 32 22
2
12
3
1 41 31 21
2
11
3
) (
) (
) (
) ( ) (
+ + +
+ + + +
+ + + +
+ + + + =
Blending functions
Blending Functions
This emphasizes that the curve is a weighted sum of
the elements of the geometry matrix.
The weights are each cubic polynomials of the
parameter u, and are called the blending functions.
The blending functions B are given by
This is similar to piecewise linear approximation, for
which only two geometric constraints (i.e. the
endpoints of the line) are needed.
So each curve segment is a straight line defined by the
endpoints G1 and G2 :
M u
Linear Interpolation (straight line)
We can represent its equation in three ways
1. As weight average of control points
X (u)=(1-u) g
1x
+ u g
2x
2. As polynomial in t
X (u)=(g
2x-
g
1x
) u + g
1x
3. As matrix form
G1
G
2
=
1 0 1
1 1
] g g [ ) (
1x 2x
u
u x
B
0
(t) p
0
+B
1
(t)p
1
Blending function
When t=0 p
0
, t=1p
1
, t=.5 midpoint
Curve is based at p0 & a vector(p
1
-p
0
)is
added which is scaled by t
Geometry Matrix, Geometry Basis,
Polynomial Basis
The key to defining a parametric cubic curve
therefore lies in the basis matrix M.
Depending on the nature of this matrix, specific
forms of curves may be created.
HERMITE CURVE
BEZIER CURVE
UNIFORM NONRATIONAL B-SPLINE
NONUNIFORM, NONRATIONAL B-SPLINE
OTHER SPLINE FORMS
Hermite Curves
The Hermite form of a cubic polynomial
curve segment is determined by
constraints on the endpoints P
1
and P
4
,
and tangent vectors at the endpoints R
1
and R
4
.
NOTE: LATER P2, P3 WILL BE USED INSTEAD OF TANGENT VECTORS TO DEFINE THE CURVE
Hermite Curves - Examples
P
1
P
4
R
1
R
4
Only the direction of R
1
varies
Only the magnitude of R
1
varies
Hermite Geometry Vector
The Hermite Geometry vector G
H
is
G
Hx
is the x component of G
H
so:
=
4
1
4
1
R
R
P
P
G
H
=
x
x
x
x
Hx
R
R
P
P
G
4
1
4
1
Hermite Curves
The Hermite basis matrix, M
H
, relates the Hermite
Geometry vector G
H
to the polynomial co-efficients.
Therefore:
where
Hx H x x x x
G M T d t c t b t a t x = + + + =
2 3
) (
| | 1
2 3
t t t T =
Hermite Curves
The constraints on x(0) and x(1) are found by direct
substitution into the previous equation:
| |
| |
x Hx H
x Hx H
P G M x
P G M x
4
1
1 1 1 1 ) 1 (
1 0 0 0 ) 0 (
= =
= =
Hermite Curves
The tangent vector constraints on x(0) and x(1) are
found by differentiation, i.e:
So:
and
| |
Hx H
G M t t t x = 0 1 2 3 ) ( '
2
| |
Hx H x
G M R x = = 0 1 0 0 ) 0 ( '
1
| |
Hx H x
G M R x = = 0 1 2 3 ) 1 ( '
4
Hermite Curves
The four constraints can be written in matrix form as:
The only way that this equation can be satisfied is if
M
H
is the inverse of the given 4x4 matrix, so:
Hx H Hx
x
x
x
x
G M G
R
R
P
P
= =
0 1 2 3
0 1 0 0
1 1 1 1
1 0 0 0
4
1
4
1
0 0 0 1
0 1 0 0
1 2 3 3
1 1 2 2
0 1 2 3
0 1 0 0
1 1 1 1
1 0 0 0
1
H
M
Matrix Inverse
Hermite Blending Functions
We know that:
The Hermite blending functions B
H
are given by , since
these weight the geometry vector G
H
.
Therefore:
H H
G M T t p = ) (
H
M T
= = =
H H H H
G B G M T t p . ) (
( )
( )
4
2 3
1
2 3
4
2 3
1
2 3
) (
) 2 (
3 2
1 3 2
R t t
R t t t
P t t
P t t
+ +
+ +
+ +
Hermite Curves - Blending Fuctions
P
1
P
4
R
1
R
4
t
f(t)
1
1
Labels show
which geometry
element is
weighted.
Two Hermite curves joined at p4
p
1
p
4
p
7
Y(t)
t
0 ,
7
4
7
4
4
1
4
1
>
withk
R
kR
P
P
and
R
R
P
P
x
x
x
x
Both curves share a
common end point
with G
1
continuity
End