Upload
johnathan-willis-chase
View
214
Download
1
Tags:
Embed Size (px)
Citation preview
CS559: Computer Graphics
Lecture 19: CurvesLi Zhang
Spring 2008
Today• Continue on curve modeling
• Reading– Shirley: Ch 15.1 – 15.5
More control points
p0
p1 2210)( ttt aaaf
p2
22
100 00)0( aaafp
22
101 5.05.0)5.0( aaafp
22
102 11)0.1( aaafp
2
1
0
2
1
0
111
25.05.01
001
a
a
a
p
p
p
2
1
0
a
a
a
C
2
1
0
2
1
01
2
1
0
242
143
001
p
p
p
p
p
p
C
a
a
a
2
1
021)(
a
a
a
f ttt
2
1
01
p
p
p
tC
2
1
0
p
p
p
tBBy solving a matrix equation that satisfies the constraints,we can get polynomial coefficients
Two views on polynomial curves
2
1
021)(
p
p
p
Bf ttt
)(1)(
2
1
02
p
p
p
Bf ttt
2210)( ttt aaaf
2
1
02 )1()(
p
p
p
Bf ttt
221100 )()()()( pppf tbtbtbt
From control points p, we can compute coefficients a
Each point on the curve is a linear blending of the control points
2
1
0
210 )()()(
p
p
p
tbtbtb
What are b0(t), b1(t), …?
1
01)(p
pBf tt
1100 )()()( ppf tbtbt
1
0
1
0
11
01
p
p
a
a
Two control point case:
11
011)()( 10 ttbtb
tt10 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1
0
0.1
0.2
0.3
0.4
0.5
0.6
0.7
0.8
0.9
1
b0(t) b1(t)
What are b0, b1, …?
2
1
02 )1()(
p
p
p
Bf ttt
221100 )()()()( pppf tbtbtbt
Three control point case:
2
1
0
2
1
0
242
143
001
p
p
p
a
a
a
242
143
001
1)()()( 2210 tttbtbtb
222 244231 tttttt
0 0.1 0.2 0.3 0.4 0.5 0.6 0.7 0.8 0.9 1-0.2
0
0.2
0.4
0.6
0.8
1
1.2
?)()()( 210 tbtbtb 1Which is b0(t)?
What are b0, b1, …?
• Why is important?– Translation-invariant interpolation
2
1
02 )1()(
p
p
p
Bf ttt
221100 )()()()( pppf tbtbtbt
Three control point case:
1)()()( 210 tbtbtb
dp
dp
dp
p
p
p
2
1
0
2
1
0 ))(())(())(()( 221100 dpdpdpf tbtbtbtnew
dppp
)()()(
)()()(
210
221100
tbtbtb
tbtbtb
df )(t for any t
Many control points
p0
p1
p2pn
002020100 )( paaaaf n
ntttt
3
0
)( Rtt i
n
i
ii
aaf
112121101)( paaaaf n
ntttt
nnnnnnn tttt paaaaf 2
210)(
nnnnn
n
n
tt
tt
tt
p
p
p
a
a
a
1
0
1
0
11
00
1
1
1
Straightforward, but not intuitive
Many control points• A shortcut
• Goal:
• Idea:
• Magic:
n
iii tbt
0
)()( pf
iit pf )(
ijtb
tb
ji
ii
0)(
1)(
n
ijj ji
ji tt
tttb
,0
)(
ni
n
ii
i
ii
i
ii
i
ii tt
tt
tt
tt
tt
tt
tt
tt
tt
tt
tt
tt
1
1
1
1
1
1
0
0
Getting bi(t) is easier!
n
ii tb
0
?)( 1 Why?
?)(0
n
iji tb nj ,1,0,1
is a polynomial of degree n
n
ii tbtB
0
)()(
Lagrange InterpolationLagrange Interpolation
If an n-degree polynomial has the same value at n+1 locations, it must be a constant polynomial
Lagrange Polynomial Interpolation
Lagrange Interpolation Demo• http://www.math.ucla.edu/~baker/java/hoefer/L
agrange.htm
• Properties:– The curve passes through all the control points– Very smooth: Cn for n control points– Do not have local control– Overshooting
Piecewise Cubic Polynomials
• Desired Features:– Interpolation– Local control – C1 or C2
33
2210)( tttt aaaaf
Natural Cubics
33
22
100 000)0( aaaafp
32
211 0302)0( aaafp
322 062)0( aafp
33
2210)( tttt aaaaf
32103 )1( aaaafp
3
2
1
0
3
2
1
0
1111
0200
0010
0001
a
a
a
a
p
p
p
p
3
2
1
0
3
2
1
0
15.011
05.000
0010
0001
p
p
p
p
a
a
a
a
Natural Cubics• If we have n points, how to use natural cubic to
interpolate them? – Define the first and second derivatives for the
starting point of the first segment. – Compute the cubic for the first segment– Copy the first and second derivatives for the end
point of the first segment to the starting point for the second segment
• How many segments do we have for n control points?
• n-1
Natutral Cubic Curves• Demo:
http://www.cse.unsw.edu.au/~lambert/splines/
Natural CubicsInterpolate control points
Has local control C2 continuity
Natural cubics
Hermit Cubics
33
22
100 000)0( aaaafp
32
211 0302)0( aaafp
3213 32)1( aaafp
33
2210)( tttt aaaaf
32102 )1( aaaafp
3
2
1
0
3
2
1
0
3210
1111
0010
0001
a
a
a
a
p
p
p
p
3
2
1
0
3
2
1
0
1212
1323
0010
0001
p
p
p
p
a
a
a
a
Hermite Cubic Curves• If we have n points, how to use Hermite cubic to
interpolate them? – For each pair, using the first derivatives at starting
and ending points to define the inbetween
• How many segments do we have for n controls? – n/2-1
Hermite CubiesInterpolate control points
Has local control C2 continuity
Natural cubics Yes No Yes
Hermite cubics
Catmull-Rom Cubics
1)0( pf
022
1)0( ppf
132
1)1( ppf
2)1( pf
3
2
1
0
5.005.00
0100
05.005.0
0010
)1(
)1(
)0(
)0(
p
p
p
p
f
f
f
f
3
2
1
0
3
2
1
0
p
p
p
p
B
a
a
a
a
Catmull
3
2
1
0
a
a
a
a
CHermite
Catmull-Rom Cubic Curves• Demo• http://www.cse.unsw.edu.au/~lambert/splines/C
atmullRom.html
• n control points define n-2 segments• Changing 1 point affects neighboring 4 segments
Cardinal Cubics
1)0( pf
02)0( ppf s
13)1( ppf s
2)1( pf
3
2
1
0
3
2
1
0
p
p
p
p
B
a
a
a
a
Cardinal
3
2
1
0
3
2
1
0
22
2332
00
0010
p
p
p
p
a
a
a
a
ssss
ssss
ss
s: tension control
3
2
1
0
00
0100
00
0010
)1(
)1(
)0(
)0(
p
p
p
p
f
f
f
f
ss
ss
3
2
1
0
a
a
a
a
CHermite
Cardinal Cubic Curves• 4 different s values
Interpolate control points
Has local control C2 continuity
Natural cubics Yes No Yes
Hermite cubics Yes Yes No
Cardinal Cubics