Designing Parametric Cubic
Curves
Ed Angel
Professor of Computer Science,
Electrical and Computer
Engineering, and Media Arts
University of New Mexico
Objectives
• Introduce the types of curves
- Interpolating
- Hermite
- Bezier
- B-spline
• Analyze their performance
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 2
Matrix-Vector Form define p ( u ) =
3 k
!
=
0 c k u k c =
& c
$
$ c
1
$
$
% c c
0
2
3
#
!
!
!
!
" u =
&
$
$
$
$ u
% u
1 u
2
3
#
!
!
!
!
" then p ( u ) = u T c = c T u
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 3
Interpolating Curve p
1 p
3 p
0 p
2
Given four data (control) points p
0
, p
1
, p
2
, p
3 determine cubic p (u) which passes through them
Must find c
0
, c
1
, c
2
, c
3
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 4
Interpolation Equations apply the interpolating conditions at u=0, 1/3, 2/3, 1 p
0
=p(0)=c
0 p
1
=p(1/3)=c
0 p
2 p
3
=p(2/3)=c
0
=p(1)=c
0
+(1/3)c
1
+(1/3) 2 c
2
+(2/3)c
+c
1
+c
2
+c
2
1
+(2/3) 2 c
2
+(1/3) 3 c
+(2/3) 3 c
2
2 or in matrix form with p = [p
0
p
1
p
2
p
3
] T p=Ac
A =
&
$
1
$
$
1
$
$
$
%
1
1
0
,
*
+
,
*
+
1
3
2
)
'
(
3
1
)
'
(
,
*
+
,
*
+
1
3
2
3
1
)
'
(
0
)
'
(
2
2
,
*
+
,
*
+
2
3
1
'
(
1
3
0
)
3
'
(
)
3
!
!
!
!
#
!
!
"
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 5
Interpolation Matrix
Solving for c we find the interpolation matrix
M
I
= A ' 1
=
&
$
$
$
$
%
'
'
1
5 .
5
9
4 .
5
0
9
' 22 .
5
13 .
5
0
' 4 .
5
18
' 13 .
5
'
4
0
1
4 .
5
.
5
#
!
!
!
!
" c = M
I p
Note that M
I does not depend on input data and can be used for each segment in x, y, and z
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 6
Interpolating Multiple
Segments use p = [p
0 p
3
] T
p
1
p
2 use p = [p p
6
] T
Get continuity at join points but not continuity of derivatives
3
p
4
p
5
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 7
Blending Functions
Rewriting the equation for p(u) p(u)= u T c = u T M
I p = b( u ) T p where b(u) = [b
0
(u) b
1
(u) b
2
(u) b
3
(u)] T is an array of blending polynomials such that p(u) = b
0
(u)p
0
+ b
1
(u)p
1
+ b
2
(u)p
2
+ b
3
(u)p
3 b
0 b
1 b
2 b
3
(u) = -4.5(u-1/3)(u-2/3)(u-1)
(u) = 13.5u (u-2/3)(u-1)
(u) = -13.5u (u-1/3)(u-1)
(u) = 4.5u (u-1/3)(u-2/3)
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 8
Blending Functions
• These functions are not smooth
- Hence the interpolation polynomial is not smooth
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 9
Interpolating Patch p ( u , v ) =
3 i
!
= o
3 j
!
= 0 c ij u i v j
Need 16 conditions to determine the 16 coefficients c ij
Choose at u,v = 0, 1/3, 2/3, 1
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 10
Matrix Form
Define v = [1 v v 2 v 3 ] T
C = [c ij
] P = [p ij
] p(u,v) = u T C v
If we observe that for constant u (v), we obtain interpolating curve in v (u), we can show
C =M
I
PM
I
T p(u,v) = u T M
I
PM
I
T v
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 11
Blending Patches p ( u , v ) =
3 i
!
= o
3 j
!
0 = b i
( u ) b j
( v ) p ij
Each b i
(u)b j
(v) is a blending patch
Shows that we can build and analyze surfaces from our knowledge of curves
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 12
Other Types of Curves and
Surfaces
• How can we get around the limitations of the interpolating form
- Lack of smoothness
- Discontinuous derivatives at join points
• We have four conditions (for cubics) that we can apply to each segment
- Use them other than for interpolation
- Need only come close to the data
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 13
p’(0)
Hermite Form p’(1) p(0) p(1)
Use two interpolating conditions and two derivative conditions per segment
Ensures continuity and first derivative continuity between segments
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 14
Equations
Interpolating conditions are the same at ends p(0) = p p(1) = p
0
3
= c
= c
0
0
+c
1
+c
2
+c
3
Differentiating we find p’(u) = c
1
+2uc
2
+3u 2 c
3
Evaluating at end points p’(0) = p’
0
= c
1 p’(1) = p’
3
= c
1
+2c
2
+3c
3
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 15
Matrix Form q
=
$
$
&
$
$
% p p p'
0 p'
3
0
3
!
!
#
!
!
"
=
$
$
%
&
1
$
$
1
0
0
0
1
1
1
0
1
0
2
0
#
1
!
!
0
3
"
!
!
c
Solving, we find c = M
H q where M
H is the Hermite matrix
M
H
=
$
$
&
$
$
%
'
1
0
2
3
'
0
0
3
2
'
0
1
1
2 '
0
0
1
1 !
!
"
!
!
#
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 16
Blending Polynomials p(u) = b( u ) T q b ( u ) =
&
$
$
$
$
%
2
' u u
3
2
3
' u
' u
3
2
3
3
'
+ u u u
2
3
2
2
+
+ u u
2
1 #
!
!
!
!
"
Although these functions are smooth, the Hermite form is not used directly in Computer Graphics and CAD because we usually have control points but not derivatives
However, the Hermite form is the basis of the Bezier form
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 17
Parametric and Geometric
Continuity
• We can require the derivatives of x, y,and z to each be continuous at join points
( parametric continuity )
• Alternately, we can only require that the tangents of the resulting curve be continuous ( geometry continuity )
• The latter gives more flexibility as we have need satisfy only two conditions rather than three at each join point
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 18
Example
• Here the p and q have the same tangents at the ends of the segment but different derivatives
• Generate different
Hermite curves
• This techniques is used in drawing applications
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 19
Higher Dimensional
Approximations
• The techniques for both interpolating and
Hermite curves can be used with higher dimensional parametric polynomials
• For interpolating form, the resulting matrix becomes increasingly more ill-conditioned and the resulting curves less smooth and more prone to numerical errors
• In both cases, there is more work in rendering the resulting polynomial curves and surfaces
Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 20