《Fundamentals of Computer Graphics》
Lecture 3 Parametric curve and surface
Yong-Jin Liu
Smooth curve and surface
Design criteria of smooth curve and
surface
• Smooth and continuity
• Ability to control the local shape
• Stability
• Is it easy to draw
Smooth and continuity
• Regard the curve as the orbit of point changing with its
parameter u
• Regard the differential of one point as the its speed
along the orbit, the direction of speed is the tangent
direction of this point
2
0 1 2( )
( ) ( )
( )
n
nx u a a u a u a u
C u y u
z u
1
1 2( ) 2
( ) ( )
( )
n
nx u a a u na u
C u y u
z u
Cn metric of curve smooth
• Differentiability of function:if parametric curve has
continuous derivative until n order at any point in the
interval [a, b],i.e. n order continuous differentiable,
then the curve is n order parametric continuous in the
interval [a, b].
• Polynomial curve has infinite order parametric
continuous C。
Polynomial curve of n order pn(x)=a0+a1x+a2x2+anx
n
Consider two curves with a common point
• Differentiability of function:if parametric curve has
continuous derivative until n order at any point in the
interval [a, b],i.e. n order continuous differentiable,
then the curve is n order parametric continuous in the
interval [a, b].
C0 continuous C1 continuous
Cn curve continuity
• Differentiability of function:if combined parametric
curve has continuous derivative until n order at the
joint point, it is called Cn or n-order parametric
continuous.
• Is there any thing wrong?
• The same curve can have different parameters.
2
2
2
1( )
( ) cos( ) 1 or ( ) sin( ) 2
( )1
tx t
x u u t
y u u ty t
t
circle:
Different parameters will get different
derivative vector!
)2,0()1(
)1(2,
)1(
4))(),((
)1,0())cos(),sin(())(),((
22
2
22
t
t
t
ttytx
uuuyux
C(u), u [a, b]
C(t), t [0, 1], ab
aut
( ) ( ) 1 ( ) 1( ) ( )
dC u dC t dt dC tC u C t
du dt du b a dt b a
Two continuity definitions
• Differentiability of function:if combined parametric
curve has continuous derivative until n order at the
joint,i.e. n order continuous differentiable, such
smooth is called Cn or n order parametric continuous.
• Geometry continuity:if the direction of
derivative vector of combined curve at the joint is
equal, then it is n order geometry continuous,
denoted by Gn.
If require G0 or C0 continuous at the joint,
that is to say two curves are continuous at the
joint.
If require G1 continuous at the joint,that is
to say two curves are G0 continuous at the
joint, and have the common derivative vector
P’(1)=aQ’(0).
when a=1,G1 continuous is also C1 continuous
If require G2 continuous at the joint,that is
to say two curves are G1 continuous at the
joint, and have common curvature vector.
This equation can be wrote as :
a, b is arbitrary constant.
When a=1,b=0,G2 continuous is also C2 continuous.
3 3
(1) (1) (0) (0)Curvature formula
(1) (0)
P P Q Q
P Q
2(0) (1) (1)Q a P bP
)(tP
)(tQ
)0(P
)1(P
)0(Q
)1(Q
Figure 3.1.7 continuous of two curves
Arc length parameterization of curve
• The same curve can have different parameter
• If u(s) is a monotonic function,then
C(s)=C(u(s)) is a new parameterization about s
of the curve
• Compute the length L(u) of curve C(u)
• If there exists parameter s,
so that L(s)=s, s 0? s = 0
Parameter s
Length L(s)
Curve C(s)
0
1
Let | ( ) |
| ( ) | ( )
( ) ( )
u
dsC u
du
s C u du L u
u s L s
Arc length parameterization of curve
( ) ( ( )) 1( ) ( )
| ( ) |
dC s dC u s duv s C u
ds du ds C u
| ( ) | 1v s
Design criteria of smooth curve and
surface
• Smooth and continuity
• Ability to control the local shape
• Stability
• Is it easy to draw
Power based representation of polynomial curve
•
•
•
0
( ) ( ( ), ( ), ( ))n
i
i
i
C u x u y u z u u
a
( , , )i i i ix y za
0 1
1
( )T
n i i
n
uC u u
u
a a a a
n order polynomial curve Cn(u)=a0+a1u+a2u
2++anun
1 order polynomial curve:
a1u+a0
a0
a1+a0
n order polynomial curve Cn(u)=a0+a1u+a2u
2++anun
See from the aspect of human
computer interaction…
2 order polynomial curve:
a2u2+a1u+a0
a0
a1
a2+a1+a0
2a2+a1
Parabola, ellipse, hyperbola?
n order polynomial curve Cn(u)=a0+a1u+a2u
2++anun
3 order polynomial curve:
a3u3+a2u
2+a1u+a0
n order polynomial curve Cn(u)=a0+a1u+a2u
2++anun
Power based representation of polynomial curve
•
• The representation and control ability is very bad
Bernstein based representation of polynomial
curve
n order polynomial curve Cn(u)=a0+a1u+a2u
2++anun
,
0
,
( ) ( )
!( ) (1 )
!( )!
n
i i n
i
i n i
i n
C u B u
nB u u u
i n i
pBeizer curve
Bernstien polynomial
1
u
u2
a0 a1
a2
2
210)( uauaauf
B0,2
B1,2
B2,2
p0 p1
p2
2,222,112,00)()( BpBpBpuCuf
Bernstein based representation of polynomial curve
• have clear geometry meaning
, ,
0 0
( ) ( ) ( )n n
i i n i n i
i i
C u B u B u
p p
Bernstein based representation of polynomial curve
• Have clear geometry meaning
• Interpolation of endpoints
, ,
0 0
( ) ( ) ( ) , [0,1]n n
i i n i n i
i i
C u B u B u u
p p
,
!( ) (1 ) , [0, 1]
!( )!
i n i
i n
nB u u u u
i n i
, 0
0
,
0
(0) (0)
(1) (1)
n
i i n
i
n
i i n n
i
C B
C B
p p
p p
Bernstein based representation of polynomial curve
• Have clear geometry meaning
• Why there exists control polygon effect when use
Bernstein based representation?
, 0,1 0 1,1 1
0
,
( ) ( ) ( ) ( )
!( ) (1 ) , [0, 1]
!( )!
n
i n i
i
i n i
i n
C u B u B u B u
nB u u u u
i n i
p p p
1 order Bezier curve
u=0 u=1
, 0,2 0 1,2 1 2,2 2
0
,
( ) ( ) ( ) ( ) ( )
!( ) (1 ) , [0, 1]
!( )!
n
i n i
i
i n i
i n
C u B u B u B u B u
nB u u u u
i n i
p p p p
2 order Bezier curve
u=0 u=1
, 0,3 0 1,3 1 2,3 2 3,3 3
0
,
( ) ( ) ( ) ( ) ( ) ( )
!( ) (1 ) , [0, 1]
!( )!
n
i n i
i
i n i
i n
C u B u B u B u B u B u
nB u u u u
i n i
p p p p p
3 order Bezier curve
u=0 u=1
9
,
0
,
( ) ( )
!( ) (1 ) , [0, 1]
!( )!
i n i
i
i n i
i n
C u B u
nB u u u u
i n i
p
9 order Bezier curve
u=0 u=1 u=0.5
Properties of Bezier curve and Bernstein base
1. Bi,n(u) 0, for all i, n and 0 u 1
2. Partition of unity ni=0Bi,n(u) = 1, 0 u 1
3. B0,n(0) = Bn,n(1) = 1
4. Bi,n(u) has and only has a maximum value
in the interval [0,1] , it is at u=i/n
5. Base set {Bi,n(u)} is symmetry about u=1/2
,
!( ) (1 ) , [0, 1]
!( )!
i n i
i n
nB u u u u
i n i
Computation method of Bezier curve
• Method 1:
• Method 2:geometry drawing
9
,
0
,
( ) ( )
!( ) (1 ) , [0, 1]
!( )!
i n i
i
i n i
i n
C u B u
nB u u u u
i n i
p
Computation method of Bezier curve
• Method 2 (geometry drawing, ruler drawing):
• example 2 order Bezier curve
2
,2
0
2 2
0 1 2
0 1 1 2
( ) ( )
(1 ) 2 (1 )
(1 )((1 ) ) ((1 ) )
i i
i
C u B u
u u u u
u u u u u u
P
P P P
P P P P
2
,2
0
2 2
0 1 2
0 1 1 2
( ) ( )
(1 ) 2 (1 )
(1 )((1 ) ) ((1 ) )
i i
i
C u B u
u u u u
u u u u u u
P
P P P
P P P P
Is this property general?
2 order Bezier curve
,
!( ) (1 ) , [0, 1]
!( )!
i n i
i n
nB u u u u
i n i
Properties of Bezier curve and Bernstein base
6. recursive definition:
Bi,n(u) = (1u)Bi,n1(u) +uBi1,n1(u)
with Bi,n(u) 0, if i < 0 or i > n
7. derivative:
B’i,n(u) = dBi,n(u) /du = n(Bi1,n1(u) Bi,n1(u) )
with B1,n1(u) Bn,n1(u) 0
Denote n order Bezier curve as
Cn(P0,,Pn), then we have
Cn(P0,,Pn)=(1u)Cn1(P0,,Pn-1)+uCn1(P1,,Pn)
Geometry drawing algorithm
n order Bezier curve has
denote Pi as P0,i
Cn(P0,,Pn)=(1u)Cn1(P0,,Pn-1)+uCn1(P1,,Pn)
Pk,i(u)=(1u)Pk1,i(u)+uPk1,i+1(u)
k = 1,,n
i = 0,,nk deCasteljau algorithm
Smooth curve and surface in 3D space
1D to 2D
• Regard the curve as the orbit of point
changing with its parameter u
2
0 1 2( )
( ) ( )
( )
n
nx u a a u a u a u
C u y u
z u
Tensor product surface
• Tensor product surfaces
• Point S(u0, v0)
• Isoparametric lines C(u) = S(u, v0) and
C(v) = S(u0, v)
,
0 0
,
( , ) ( ( , ), ( , ), ( , ))
( ) ( )
[ ( )] [ ][ ( )]
n m
i j i j
i j
T
i i j j
S u v x u v y u v z u v
f u g v
f u g v
b
b
Base function
Geometry coefficient
Tensor product Bezier surface
• Point S(u0, v0)
• Isoparametric lines C(u) = S(u, v0) and C(v) = S(u0, v)
, , ,
0 0
( , ) ( ) ( )n m
i n j m i j
i j
S u v B u B v
P
, , ,
0 0
( , ) ( ) ( )n m
i n j m i j
i j
S u v B u B v
P
2D Bernstein base
Computation method of Bezier curve
• Geometry drawing algorithm
• deCasteljau algorithm
Computation method of Bezier curve
• deCasteljau algorithm
, , ,
0 0
, , ,
0 0
,
0
( , ) ( ) ( )
( ) ( )
( )
n m
i n j m i j
i j
n m
i n j m i j
i j
n
i n i
i
S u v B u B v
B u B v
B u
P
P
Q u
v
Design criteria of smooth curve and
surface
• Smooth and continuity
• Ability to control the local shape
• Stability
• Is it easy to draw
• Is Bezier curve perfect?
Beizer curve
• The representation and control ability of local
shape is bad
• if interpolate many (n+1) discrete point s,
then require a high order (n) Bezier curve.
How to improve?
• Splicing many Bezier curve segments
n order polynomial curve Cn(u)=a0+a1u+a2u
2++anun
Design of B-spline curve
• Determine the order of continuity p
• Determine node vector U = {u0, u1, , um};
• Determine a set of control points {P0, P1, ,
Pn};
• The form of B-spline curve is
,
0
( ) ( )n
i p i
i
C u N u
P
B-spline surface
• Tensor product surface
, , ,
0 0
( , ) ( ) ( )n m
i p j q i j
i j
S u v N u N v
P
1
1 1
11
1
1 1
11
{0, ,0, , , ,1, ,1}
{0, ,0, , , ,1, ,1}
r
p r p
pp
s
q s q
U u u
V u u
1 and 1r n p s m q
Ability of local shape change
Ability of local shape change
The reason is the local scope of basic function
, , ,
0 0
( , ) ( ) ( )n m
i p j q i j
i j
S u v N u N v
P
, , , 1 1( ) ( ) [ , ) [ , )i j i p j q i i p j j qN u N v u u v v P
Some extensions of NURBS curve and surface
• Free form deformation (FFD)
• Subdivision surface
Free deformation of parametric curve and
surface (FFD)
• 1D curve
• 2D surface
• 3D solid
,
0
( ) ( )n
i p i
i
C u N u
P
1
1 1
11
{0, ,0, , , ,1, ,1}
m
p m p
pp
U u u
Free deformation of parametric curve
and surface (FFD)
• 1D curve
• 2D surface
• 3D solid
, , ,
0 0
( , ) ( ) ( )n m
i p j q i j
i j
S u v N u N v
P
1
1 1
11
1
1 1
11
{0, ,0, , , ,1, ,1}
{0, ,0, , , ,1, ,1}
r
p r p
pp
s
q s q
U u u
V u u
Free deformation of parametric curve and
surface (FFD)
• 1D curve
• 2D surface
• 3D solid
1
1 1
11
1
1 1
11
1
1 1
11
{0, ,0, , , ,1, ,1}
{0, ,0, , , ,1, ,1}
{0, ,0, , , ,1, ,1}
o
p r p
pp
s
q s q
t
r t r
rr
U u u
V u u
W u u
, , , , ,
0 0 0
( , , ) ( ) ( ) ( )n m l
i p j q k r i j k
i j k
S u v w N u N v N v
P
Free deformation of parametric curve
and surface (FFD)
•1D curve
•2D surface
•3D solid
•Further expansion?
Free deformation of parametric curve
and surface (FFD)
•1D curve
•2D surface
•3D solid
•Further expansion?
Extended Free Form Deformation
Selective Course Project 6
Try to program the following shape
using GDI+:
Tips: The following code constructs a complicated region using two spline curves
using namespace Gdiplus; Graphics graphics( pDC->m_hDC ); Pen pen(Color::Blue, 3); Point point1( 50, 200); Point point2(100, 150); Point point3(160, 180); Point point4(200, 200); Point point5(230, 150); Point point6(220, 50); Point point7(190, 70); Point point8(130, 220); Point curvePoints[8] = {point1, point2, point3, point4, point5, point6, point7, point8}; Point* pcurvePoints = curvePoints; GraphicsPath path; path.AddClosedCurve(curvePoints, 8, 0.5); PathGradientBrush pthGrBrush(&path); pthGrBrush.SetCenterColor(Color(255, 0, 0, 255)); Color colors[] = {Color(0, 0, 0, 255)}; INT count = 1; pthGrBrush.SetSurroundColors(colors, &count); graphics.DrawClosedCurve(&pen, curvePoints, 8, 0.5); graphics.FillPath(&pthGrBrush, &path);