Spline Represenations
*
Spline Representation
Spline is a flexible strip used to produce a smooth curve through a set of
points. Splines are used to design curve and surface shapes like automobile
bodies, aircrafts, home appliances and more.
Cubic splines are most popular. given a set of n 1 control points
p k xk , yk , zk , k 0,1,
p0
pk
, n, a cubic interpolation fits the points.
p k 1
pn
x u axu 3 bxu 2 cxu d x , y u a y u 3 by u 2 c y u d y
z u az u 3 bz u 2 cz u d z , 0 u 1.
*
At each of n-1 internal point we require that two successive curve sections
pass through that point and also the equality of their 1st and 2nd derivatives,
thus imposing 4(n-1) equations of 4n polynomial coefficients. Two more
equations are obtained from passing through the first and last points. The
last two equations can be obtained by requiring the 2nd derivative at first
and last points to be zero.
A major drawback is that a change in the position of one control point needs
recalculation of all coefficients. This is solved by specifying the tangent at
each control point. Then, a change in position of one point affects only two
sections of the curve. This is called Hermite interpolation.
P u x u , y u , z u
pk
p k 1
P 0 pk
P 1 p k 1
P 0 Dp k
P 1 Dp k 1
Dpk is parametric derivative (curve slope).
*
There is P u au 3 bu 2 cu d, 0 u 1. The x component of P u is
x u axu 3 bxu 2 cu d and similarily for y and z.
P u u 3 u 2
p k 0
p 1
k 1
Dp k 0
Dp
k 1 3
a
b
u 1 ,
c
d
P u 3u 2
a
b
2u 1 0
c
d
0 0 1 a
a 2 2 1 1 p k
b 3 3 2 1 p
1 1 1 b
k 1
c 0 0 1 0 Dp k
0 1 0 c
Dp
2 1 0 d
d
1
0
0
0
k 1
MH
The inverse boundary constraints matrix M H is called Hermite matrix.
*
The curve segment between the constraint points p k and p k 1 is therefore
P u u 3 u 2
pk
p
u 1 M H k 1
Dp k
Dp
k 1
p k 2u 3 3u 2 1 p k 1 2u 3 3u 2
H 0 u
H1 u
H0
H1
Dp k u 3 2u 2 u Dp k 1 u 3 u 2
H 2 u
H 3 u
H i u , i 0,1, 2,3, are called
H4
H3
Hermite Blending Functions.
*
Other Splines
The requirements of curve derivative values control point may be a problem.
Instead, the derivatives can naturally be defined based on the control points.
In Cardinal splines a curve section is completely defined by the position of
four consecutive points.
P 0
1
1 t p k 1 p k 1 ,
2
P 1 p k 1 , P 0
1
1 t p k 2 p k .
2
P 0 pk ,
pk
p k 1
t is called tension parameter, controlling how
p k 1
pk 2
loosely or tightly it fits the control points.
*
t < 0: looser curve
t > 0: tighter curve
Cardinal matrix and blending functions are derived similarly as in Hermite
splines. Setting s=(1-t)/2
*
P u u 3
u2
s 2 s s 2 s p k 1
2s s 3 3 2s s p
k
u 1
s
0
s
0 p k 1
p
0
1
0
0
k 2
MC
p k 1 su 3 2 su 2 su p k 2 s u 3 s 3 u 2 1
CAR 0 u
CAR 1 u
p k 1 s 2 u 3 3 2 s u 2 su p k 2 su 3 su 2
CAR 2 u
CAR 3 u
CARi u , i 0,1, 2,3, are called Cardinal Blending Functions.
*
There are few more splines with more parameters than tension, designed
to model animation paths with abrupt changes in motion.
*
Bezier Curves
Bezier Spline Curves
Developed by Pierre Bezier at Renault corporation for the design of automobile
bodies. Bezier splines are very useful for design of curves and surfaces.
Let p k xk , yk , zk , 0 k n, be n 1 control points, blended
to create a position vector P u describing a path from p 0 to p n .
P u k 0 p k BEZk ,n u , 0 u 1, where
n
BEZk ,n u C n, k u k 1 u
nk
, C n, k
n!
k ! n k !
Bezier curve is a polynomial of degree one less the number of control points.
Coefficients and blending functions satisfy recursive relations as follows:
*
C n, k
n k 1
C n, k 1 , n k
k
BEZk ,n u 1 u BEZk ,n 1 u u BEZk 1,n 1 u , n k 1, with
BEZk ,k u u k and BEZ0,k u 1 u .
k
p1
p1
p0
p2
p2
p0
p3
p0
p7
*
Properties of Bezier Curves
A useful property is that the curve connects to first and last control
points: P 0 p0 , P 1 p n .
The parametric derivative at the end control points is given by:
P 0 np 0 np1 , P 1 np n 1 np n .
The slope of the cure at the end points is along the line joining the
last two end points.
The parametric second derivatives is given by:
P 0 n n 1 p 2 p1 p1 p 0 ,
P 1 n n 1 p n 2 p n 1 p n 1 p n ,
*
Another important property of any Bezier curve is its containment in the
convex hall of the control point. This follows from P u being a positive
sum of the control points where sum of weights is k 0 BEZk ,n u 1.
n
Cubic Bezier Curves
Bezier curves with many points are expensive to compute due to high degree
of polynomials. It is common to “patch” curves of four points and construct it
from piecewise cubic curves.
BEZ0,3 1 u , BEZ1,3 3u 1 u , BEZ2,3 3u 2 1 u , BEZ3,3 u 3 .
3
2
The following illustrates the four blending functions and how they relate to
various curves.
*
*
1 3 3
3 6 3
Polynomial
P u u 3 u 2 u 1
3 3 0
expansion yields:
1 0 0
M Bez
1 p0
0 p1
0 p2
0 p3
Complex curves can be constructed by patching cubic Bezier splines. Given
two control points, in order to obtain C1 continuity of the patch a new point
is introduced and its position is defined by equation the expression of first
derivative for u=1 with the next one for u=0. If C2 continuity is desired, a
second point is introduces and the expressions of the second derivatives
are also equated.
*
B-Spline Curves and
Surfaces
Displaying Spline Curves and Surfaces
We must determine positions of points on curves and surfaces for displaying
those. Parametric polynomial splines must be calculated by steps increments
over range of parameter, e.g. [0,1]. This is very time consuming and efficient
computations methods are in order.
Consider a cubic spline x u axu 3 bxu 2 cxu d x . Applying
Horner's rule x u axu bx u cx u d x requires 4 additions
and 3 multiplications. This must be repeared for every displayed
point, which is very expensive.
A method called Forward-Difference is very efficient and requires mostly
additions.
*
Let us increase u 0,1 in steps u0 0, uk 1 uk , k 0,1, 2,
This results corresponding increments xk 1 xk 1 xk in x. Substitution
of uk in x u yields:
xk 1 ax uk bx uk cx uk d x
3
2
axuk3 bxuk2 cxuk d x 3ax uk2 3ax 2 2bx uk ax 3 bx 2 cx
1 xk
1 xk is quadratic polynomial of u. 1 xk 1 1 xk 2 xk . Substitution
xk
of uk in 1 xk yields
1 xk uk = 3ax uk 3ax 2 2bx uk ax 3 bx 2 cx
2
1 xk uk 6axuk 2 6ax 3 2bx 2
2 xk
*
Similarily,
2 xk uk 6ax uk 2 6ax 3 2bx 2 2 xk 6ax 3
3 xk
At x0 there exists u0 0. Hence x0 d x , 1 x0 ax 3 bx 2 cx ,
2 x0 6ax 3 2bx 2 and 6ax 3 .
Then x1 x0 1 , x2 x1 1 2 , and x3 x2 1 2 3 .
x4 can be derived from x1 by considering x1 as a starting point
and progressing with 3 forward differences.
Hence xi 3 xi 31 2 2 3 , requiring only 3 additions for
eavery new point.
*