CURVE
REPRESENTATION
Representation
Non-parametric
form: y = f(X) Explicit form:
y = mx + b
Implicit form:
f(x, y) = 0 Parametric form:
x = x(t)
y = y(t)
2
nddegree implicit representation:
0 2
2
2 2
2 + bxy + cy + dx + ey + f =
ax
Any guess, why the factor 2 is used ?
This form of the expression, with the coefficients, provide a wide variety of 2D curve forms called:
CONIC SECTIONS
F(a, 0) x y
P(x, y) M
directrix x= -a
O
PARABOLA
F(ae, 0) x y
P(x, y) M
directrix x= a/e O
HYPERBOLA directrix
x= -a/e
F(ae, 0) x
y
P(x, y)
directrix x= -a/e
O
ELLIPSE F(-ae, 0)
directrix
x= a/e
CONIC SECTIONS
PARABOLA HYPERBOLA ELLIPSE
2
2
2
4 ; 0
: ( ,0);
. eccentricity, 1
; 2 .
tan ( );
2 tan( ).
y ax a Focus a
Directrix a e x at y at or
x
y a
φ
φ
= >
= −
=
= = ±
=
= ± [ , ].
);
sin(
), cos(
. / :
);
0 , (
: . 1 0
);
1 (
. 0
; 1
2 2
2
2 2 2
2
π π
−
∈
=
=
±
=
±
≤
≤
−
=
>
≥
= +
t
t b
y
t a
x
e a x
s Directrice
ae Foci
e
e a
b
b a
b y a
x
. /
;
; 2 e
: Hyperbola
r Rectangula
. 2 / 2
/
);
tan(
), sec(
; / :
).
0 , (
:
; 1
);
1 (
; 1
2 2 2
2 2 2
2
t c y
ct x
t t b
y
t a
x
e a x
s Directrice
ae Foci
e
e a b
b y a
x
=
=
=
<
<
−
=
=
±
=
±
>
−
=
=
−
π
π
Ellipse (e=1/2), parabola (e=1) and hyperbola (e=2) with fixed focus F and directrix.
For circle,
e = 0.
??Polar Equation of a conic (home assignment):
) ,
( where,
) , cos(
1
. L dist F d
e
L
r e =
= +
θ
F – Focal Point; d – Directrix;
e – Eccentricity.
Condns: Focal point at Origin;
e.L =
l
; is called the “semi-latus rectum”.0 2
2
2 2
2 + bxy + cy + dx + ey + f =
ax
If the conic passes through the origin: f = 0.
Assuming, one of the parameters to be a constant, c = 1.0, f = 1.0
Remaining 5 Coeffs. may be obtained using 5 geometric conditions:
Say:
Boundary Conditions -
– two (2) end points
- slope of the curves at two (2) end points.
and - one (1) intermediate point
0 2
2
2 2
2 + bxy + cy + dx + ey + f =
ax
[ ]
0
0 1
1 , 0
as
= +
+
=
=
f GX
XAX or
y x
f e
d
e c
b
d b
a y
x
XSX
T
T
Generalized CONIC
Re-organize:
S is symmetric
Special Conditions:
If b
2= ac, the equation represents a PARABOLA;
If b
2< ac, the equation represents an ELLIPSE;
If b
2> ac, the equation represents
a HYPERBOLA.
SPACE CURVE (3-D)
Explicit non-parametric representation:
x = x, y = f(x), z = g(x).
Non-parametric implicit representation:
f(x, y, z) = 0, g(x, y, z) = 0.
Intersection of the above two surfaces represents a curve.
Examples:
. ,
,
23
y t z t
t
x = = =
Curve on the seam of a
baseball: . sin( 2 ).
)], 4 / (
3 sin . )
4 / sin(
. [
)], 4 / (
3 cos .
) 4 / cos(
. [
θ
π θ
π θ
μ
π θ
π θ
λ
c z
b a
y
b a
x
=
+
− +
=
+
− +
=
where,
. 0 . 1 0
, 2
);
/ ( 1
) 2 sin(
. 1
), / ( 1
) 2 sin(
. 1
≤
≤
=
−
=
−
=
+
= +
=
t t
c z d d
c z d d
π θ
θ μ
θ λ
HELIX:
∞
<
<
−∞
≠
=
=
=
t b
bt z
t r
y t
r x
, 0
; ),
sin(
. ),
cos(
.
A parametric space curve:
x = x(t), y = f(t), z = g(t).
PARAMETRIC CUBIC CURVES
. )
( ) (
) (
2 3
, 2
3
, 2
3
z z
z z
y y
y y
x x
x x
d t
c t
b t
a t
z
d t
c t
b t
a t
y
d t
c t
b t
a t
x
+ +
+
=
+ +
+
=
+ +
+
=
[ ]
[ ]
=
=
=
=
z y
x
z y
x
z y
x
z y
x
d d
d
c c
c
b b
b
a a
a and C
t t
t where, T
T.C, z(t)
y(t) x(t)
Q(t)
2
1
3
CUBIC CURVE:
- identify geonetrical/mathematical properties
PARAMETRIC CUBIC Splines
. )
( ) (
) (
2 3
, 2
3
, 2
3
z z
z z
y y
y y
x x
x x
d t
c t
b t
a t
z
d t
c t
b t
a t
y
d t
c t
b t
a t
x
+ +
+
=
+ +
+
=
+ +
+
=
[ ]
[ ]
=
=
=
=
z y
x
z y
x
z y
x
z y
x
d d
d
c c
c
b b
b
a a
a and CF
t t
t where, T
CF, T
z(t) y(t)
x(t)
P(t) .
2
1
To solve for: 3
1
P ; T
CF =
−What do you need ??
Spline curve refers to any composite curve, formed with Polynomial sections,
satisfying specific continuity conditions (1st and 2nd
derivatives) at the boundary of the pieces.
With 7
Polynomial segments
Quadratic spline With 6 Polynomial segments
[ ]
[ ]
=
=
=
=
z y
x
z y
x
z y
x
z y
x
d d
d
c c
c
b b
b
a a
a and CF
t t t where, T
T.CF, z(t)
y(t) x(t)
P(t)
2 1
3
[ ]
[ 3 2 1 0 ] ;
) ( '
; 1
) (
. 1 0
;
2 2 3
2 3
=
=
≤
≤ +
+ +
=
D C
B A t
t t
P
D C B A t
t t
t P
t D
Ct Bt
At P(t)
Hermite Boundary Conditions:
; )
1 ( '
; )
0 ( '
; )
1 (
; )
0 (
1 0
1 0
DP P
DP P
P P
P P
=
=
=
=
To solve for:
1
P ; T
CF =
−You need four (4) boundary conditions ??
[ ]
[ 3 2 1 0 ] ;
) ( '
; 1
) (
. 1 0
;
2 2 3
2 3
=
=
≤
≤ +
+ +
=
D C B A t
t t
P
D C B A t
t t
t P
t D
Ct Bt
At P(t)
; )
1 ( '
; )
0 ( '
; )
1 (
; )
0 (
1 0
1 0
DP P
DP P
P P
P P
=
=
=
=
; 0
1 2
3
0 1
0 0
1 1
1 1
1 0
0 0
) 1 (
) 0 (
) 1 (
) 0 (
=
D C
B A
DP DP
P P
Solve to get:
);
( )
1 (
) 0 (
) 1 (
) 0 (
0 1
2 3
0 1
0 0
1 1
1 1
1 0
0
0
1CF G
M DP
DP P P
D C
B A
H
=
=
=
−; 0
1 2
3
0 1
0 0
1 1
1 1
1 0
0 0
) 1 (
) 0 (
) 1 (
) 0 (
=
D C
B A
DP DP
P
P
M is a 4x4 basis matrix and G is a four element column vector of geometric
constants, called the geometric vector.
[ ]
[ ]
[ ] m
ij xG [ g g g g ]
TG
M T
t z t
y t
x t
Q
4 3
2 4 1
4
2 3
and M
, 1 t
t t
T where,
, . .
) ( )
( )
( )
(
=
=
=
=
=
In general:
The curve is a weighted sum of the elements of the geometry matrix.
The weights are each cubic polynomials of t, and are called the blending functions:
B = T.M.
CUBIC SPLINES
=−
≤ ≤
=
41
2 1
i
i i
i
t ;t t t .
B
P(t) P(t) is the
position vector of any point on the cubic spline
segment.
P(t) = [x(t), y(t), z(t)] Cartesian Cylindrical
Spherical or [r(t), θ (t), z(t)]
or [r(t), θ (t), φ (t)]
. t t
t t
B z(t)
t B y(t)
t B x(t)
i
i iz i
i iy i
i ix
2 1
4 1
1 4
1
1 4
1
1
≤
≤
=
=
=
=
−
=
−
=
−
2 1
3 4 2
3 2
1
t t
t
, t B t
B t
B B
P(t)
≤
≤
+ +
+
=
Use boundary conditions
to evaluate the
coeficients
4 2 3
2
4 1
2
3 2
' 1
t B t
B B
t )B (i
(t) P
i
i i
+ +
=
−
=
=
−
Let, t
1=0:
'.
P )
P'(t ';
P )
P'(
. P )
P(t
; P )
P(
1 2
1
2 2
1
0
0
=
=
=
P
1, t
1=
P
2, t
2P
1’
P
2’
Solutions:
);
' (t P t
B t
B B
);
P(t t
B t
B t
B B
' ; P B
; P B
2 2 2 4 2
3 2
3 2 2 2 4
2 3 2
2 1
1 2
1 1
3 2
= +
+
= +
+ +
=
=
t ; P ' t
P ' t
) P B (P
t ; P ' t
P ' t
) P B (P
22 2 22
1 23
2 1
4
2 2 2
1 22
1 2
3
2
2 3
+
− +
=
−
− −
=
; t t
P ' t
P ' t
) P (P
t t P ' t
P ' t
) P t (P
P ' P
t P
3 22
2 22
1 23
2 1
2 2
2 2
1 22
1 2
1 1
2 ] [
2 ] [ 3
) (
+
− + +
−
− − +
+
=
Equation of a single cubic spline segment:
Various other approaches used are:
• Normalized Cubic splines
• Blending
• Weighting functions.
) (
) 2
(
) 3
2 (
) 1 3
2 ( )
(
2 2 3
2 1 3
2 2 3
2 1 3
t ' t
P t
t ' t
P
t t
P t
t P
t P
− +
+
− +
+
− +
+
−
=
Rewrite as:
==
30
) ( )
(
k
k
k
H u
g u
P
[ ]
−
−
−
−
=
=
=
=
+ +
' ' 0
0 0
1
0 1
0 0
1 2
3 3
1 1
2 2
1 .
. )
(
; .
1 2 1
3
k k k
k
P P P
P t
t t
G M T t
P
M T B
Equation of a
normalized cubic spline segment:
Use, t2 = 1;
);
( )
1 (
) 0 (
) 1 (
) 0 (
0 1
2 3
1 1
0 0
1 1
1 1
1 0
0
0
1CF G
M DP
DP P P
D C
B A
H
=
=
=
−Remember,
The derivation:
For piece-wise continuity for complex curves, two or more curve segments are joined together.
In that case, use second derivative P
2’’(t) at end-points (joints).
; t t
P ' t
P ' t
) P (P
t t P ' t
P ' t
) P t (P
P ' P
t P
3 22
2 22
1 23
2 1
2 2
2 2
1 22
1 2
1 1
2 ] [
2 ] [ 3
) (
+
− + +
−
− − +
+
=
Equation of a single cubic spline segment:
[ ]
[ ] [ ]
[ ] ;
and
M , 1 t
t t
T where,
, . .
. )
( )
( )
( )
(
4 3
2 1
4 4 2
3
T
ij x
g g
g g
G
m
G B G
M T
t z t
y t
x t
P
=
=
=
=
=
=
The degree three polynomial - known as a cubic polynomial - is the one that is most typically chosen for constructing smooth
curves in computer graphics.
It is used because:
1. it is the lowest degree polynomial that can support an inflection - so we can make interesting curves, and
2. it is very well behaved numerically - that means that the curves will usually be smooth like this:
and not jumpy like this:
control points:
(-1, 2); (0, 0); (1, -2); (2, 0) Solution for the Coefficients can be given as:
−
− −
=
−
0 2 0 2
8 4 2 1
1 1 1 1
0 0 0 1
1 1
1
1 1
d c b a
Cubic Polynomial - why and how ?
What do we do here – even 3rd degree is insufficient.
What about degree five, with how many extra control points ??
3
Piecewise polynomial curves:
Three factors in the design:
• Actual Degree/order in the response of the system ??
• No. of Control Points
• Degree of the Polynomial ?
t B B
t B i
) (i
(t) P
i
i i
4 3
4 1
3
6 2
) 2 (
' 1 '
+
=
−
−
=
=
−
P
1, t
1P
2, t
2P
1’
P
2’
P
3, t
3P
3’
; 2
"
: segment second
the
of beginning
the At
0) 3
(t
B
P
==
P1’ and P3’ known, But what about P2’ ?
2 3 4 3
2
2 6 " 0 2
'' (t ) B B t P ( ) B
P = + = =
t ; P ' t
P ' t
) P B (P
t ; P ' t
P ' t
) P B (P
22 2 22
1 23
2 1
4
2 2 2
1 22
1 2
3
2
2 3
+
− +
=
−
− −
=
−
− −
=
−
− − +
+
− +
t 3 3 ' P t 3
2 ' 2P 2 3
t
2 ) 3 P
2 3(P t 2
2 ' P t 2
1 ' 2P 2 2
t
1 ) 2 P
2 3(P 2 2
t 2 ' P 2 2 t
1 ' P 2 3
t
2 ) 1 P
2(P
6t 2
; t t
P ' t
P ' t
) P
(P
t t P ' t
P ' t
) P t (P
P ' P
t P
k k k
k k
k k
k k k
k k
k k
k k
k
3 2 1
1 2 1
3 1
1
2 1
1 2 1
1 1
2 ] [
2 ] [ 3
) (
+ + +
+
+
+ + +
+ +
+
− + +
−
− − +
+
=
Generalized equation for any two adjacent cubic spline segments, P
k(t) and P
k+1(t) :
; t t
P ' t
P ' t
) P
(P
t t P ' t
P ' t
) P
t (P P '
P t
P
k k k
k k
k k
k k k
k k
k k
k k
k
3 2 2
2 2 2
1 3 2
2 1
2 2
2 2
1 2 2
1 2
1 1
1
2 ] [
2 ] [ 3
) (
+ + +
+ +
+ +
+ + +
+ +
+ + +
+ +
+
− + +
−
− − +
+
=
For first segment:
For second segment:
Curvature Continuity ensured as:
[ ]
−
−
−
−
=
=
=
=
+ +
' ' 0
0 0
1
0 1
0 0
1 2
3 3
1 1
2 2
1 .
. )
(
; .
1 2 1
3
k k k
k
P P P
P t
t t
G N T t
P
N T F
Equation of a
normalized cubic spline segment:
Use, t2 = 1;
For curvature Continuity:
] [
3 4
'
k' 1 k' 2 k 2 kk
P P P P
P +
++
+=
+−
) (
) 2
(
) 3
2 (
) 1 3
2 ( )
(
2 3
2
2 3
1
2 3
2
2 3
1
t ' t
P
t t
' t P
t t
P
t t
P t
P
− +
+
− +
+
−
+ +
−
The Hermite =
Splines
For curvature Continuity:
] [
3 4
'
k' 1 k' 2 k 2 kk
P P P P
P +
++
+=
+−
For three control points (knots) this works as:
For N points ??
For 3 points – 1 Eqn. (& 1 unknown) For 4 points – 2 eqns. (& 2 unknowns) . .
. For N points – (N-2) eqns. (& N-2 unknowns)
In general:
Write the eqn. set for N = 5; in matrix form.
; 4 / ] )
( 3
' [ '
' 3 1 1
3
2 P P P P
P = − − −
Solve using:
Forward- backward substitution:
Thomas Algm.
] [
3 4
'
k' 1 k' 2 k 2 kk
P P P P
P +
++
+=
+− Lets solve for N = 4;
] [
3 4
'
];
[ 3 4
'
2 4
' 4 '
3 2
1 3
' 3 '
2 1
P P
P P
P
P P
P P
P
−
= +
+
−
= +
+
Re-arrange to get:
−
−
−
−
−
= −
−
−
−
= −
' 4 2
4
' 1 1
3 '
3 ' 2
' 4 2
4
' 1 1
3 '
3 ' 2
) (
3
) (
3 4
1
1 ) 4
1 15 (
) ; (
3
) (
3 4
1
1 4
P P
P
P P
P P
P
P P
P
P P
P P
P
Problem:
The position vectors of a normalized cubic spline are given as (0 0), (1 1), (2 -1) and (3 0).The tangent vectors at the ends are both (1 1).
Soln:
The 2 internal tangent vectors are calculated, and both are equal to (1 –0.8).Two
piecewise cubic
spline
segments
No use of 2nd derivative smoothing
Using 2nd derivative smoothing
Examples of spline interpolation
No use of 2nd derivative smoothing
Using 2nd derivative smoothing
Other Variants:
- Cardinal Splines;
- Catmul-Rom splines - Irvine-Hall Splines - T-spline
- B-spline
BEZIER CURVES
• Basis functions are real
• Degree of polynomial is one less than the number of points
• Curve generally follows the shape of the defining polygon
• First and last points on the curve are
coincident with the first and last points of the polygon
• Tangent vectors at the ends of the curve have the same directions as the respective spans
• The curve is contained within the convex hull of the defining polygon
• Curve is invariant under any affine
transformation.
A few typical examples of
cubic polynomials for Bezier
BEZIER CURVES
B
0B
1B
2B
31 0
; ) ( )
(
0
,
≤ ≤
=
=
t t
J B t
P
ni
i n i
Equation of a parametric Bezier curve:
B
i’s are called the control points;
)!
(
!
!
; )
1 ( )
,
(
i n
i
n i
n
t i t
t n
J
n i i n i= −
−
=
−Binomial Coefficients:
(ith, nth-order Bernstein basis function) where the Bezier or Bernstein basis or
blending function is:
J
n,i(t) is the ith, nth order Bernstein basis function.
n is the degree of the defining
Bernstein basis function (polynomial curve segment).
This is one less than the number of
points used in defining Bezier polygons.
)!
(
!
!
; )
1 ( )
,
(
i n
i
n i
n
t i t
t n
J
n i i n i= −
−
=
−; )
i)! ( i!(n
) n!
(
J
n,i0 0
i1 − 0
n i= 0
= −
−For i ≠ 0 :
; )
!n! ( ) n!
(
J
n,0 1 0
n1
0 0
0 00
= −
−=
1 0
0
≤
≤
=
=
t
; (t) J
B P(t)
ni
n,i i
Limits for i = 0 :
0
0=1; 0! = 1
Thus:
. B )
( J
B )
P( 0 =
0 n,00 =
0. B )
( J
B )
P( 1 =
n n,n1 =
nAlso:
n.
,i )
( J
n;
,i )
( J
n,i n,n
≠
=
=
= 0 1
1 1
For any t:
= n=
i
i
n
t
J
0
,
( ) 1
Also Verify:
1
);
( .
) ( ).
1 (
) (
) 1 ( ), 1 (
), 1 (
,
≥
>
+
−
=
−
−
− t t J t n i
J t
t J
i n
i n
i
n
J
2,0J
2,1J
2,2t ->
0 1
1
n = 2 t ->
0 1
1
0.5
1/3 2/3
J
3,0J
3,1J
3,2J
3,3n = 3 (cubic)
Below are some examples of BBF
(Bezier /Bernstein blending functions:
i)!
i!(
i i
n
= −
=
3 3 6
Take n = 3:
i)!
i!(n n!
i
; n t)
( i t
(t) n
J
n,i i n i= −
−
= 1
−. )
(
);
1 .(
. 3 )
(
; ) 1
.(
. 3 )
(
; ) 1
( )
1 ( .
1 )
(
3 3
, 3
2 2
, 3
2 1
, 3
3 3
0 0
, 3
t t
J
t t
t J
t t
t J
t t
t t
J
=
−
=
−
=
−
=
−
=
[ ] ;n .
B B B B t
t t
B t
t)B (
t B
t) t(
B t) (
P(t)
3 0
0 0
1
0 0
3 3
0 3
6 3
1 3
3 1
1
1 3
1 3
1
3 2 1 0 2
3
3 3 2
2 1
2 0
3
=
−
−
−
=
+
− +
− +
−
Thus, =
for Cubic Bezier:
[ ]
T
k k k
k
P P P
P t
t t
G N T t
P
−
−
−
−
=
=
=
+ +
' ' 0
0 0
1
0 1
0 0
1 2
3 3
1 1
2 2
1 .
. )
(
1 2 1
3 For
Cubic-splines: