Catmull-Rom Splines - Interactive Computer Graphics - Slides | CS 418, Study notes of Computer Graphics

Material Type: Notes; Class: Interactive Computer Graphics; Subject: Computer Science; University: University of Illinois - Urbana-Champaign; Term: Fall 2003;

Typology: Study notes

Pre 2010

Uploaded on 03/16/2009

koofers-user-r7y
koofers-user-r7y 🇺🇸

10 documents

1 / 4

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Catmull–Rom Splines
Given a set of points in space, suppose we want a spline that
interpolates the data points [rules out Bézier]
•with C1continuity [Hermite: lots of tweaking]
This is a common situation in animation
We start with the given set of points
define tangent ,, ( )
niii
s
0+11
=−pp rpp!
Catmull–Rom Splines
Typically, we pick s= ½ and we can derive a spline equation
More generally, we can use any tension parameter s
−3
−2
23
−1
0200
ªº
ªº
«»
«»
−1 0 1 0
1«»
«»
ªº
=1
¬¼ «»
«»
2−54−1
2«»
«»
−1 3 −3 1
¬¼
¬¼
()
i
i
i
i
uuuu
p
p
pp
p
−3
−2
23
−1
01 0 0
ªº
ªº
«»
«»
−0 0
«»
«»
ªº
=1
¬¼ «»
«»
2−332
«»
«»
−2 2
¬¼
¬¼
()
i
i
i
i
ss
uuuu
ss s s
sss s
p
p
pp
p
B-Splines
Like Catmull–Rom splines, start with sequence of points
Curves no longer interpolate control points
points where segments actually meet are called knots
for Hermite et al the knots were always control points
Lack of interpolation isn’t a big problem for interactive design
but it’s hard to predict curve just based on points coordinates
,,
n0
pp!
−3
−2
23
−1
1410
ª
º
ªº
«
»
«»
−3 0 3 0
1
«
»
«»
ªº
=1
¬¼
«
»
«»
3−630
6
«
»
«»
−1 3 −3 1
¬
¼
¬
¼
()
i
i
i
i
uuuu
p
p
pp
p
B-Spline Basis Functions
Non-negative functions
implies convex hull property
()bu
1()bu
4
()bu
3
()bu
2
()
()
()
()
()
()
()
bu u
bu u u
bu u u u
bu u
3
1
32
2
32
3
3
4
1
=1
6
1
=36+4
6
1
=−3+3+3+1
6
1
=6
() () () ()
iiii
bu b u bu b u
1−32−23−14
+++pppp
pf3
pf4

Partial preview of the text

Download Catmull-Rom Splines - Interactive Computer Graphics - Slides | CS 418 and more Study notes Computer Graphics in PDF only on Docsity!

Catmull–Rom Splines Given a set of points in space, suppose we want a spline that^ • interpolates the data points

[rules out Bézier] (^1) • with C continuity

[Hermite: lots of tweaking]

This is a common situation in animationWe start with the given set of points

define tangent ,^ ,^

(^ )

n^

i^ i^ si

0

=^ −+1^ −

p^ p^

r^ p^

p

!

Catmull–Rom Splines Typically, we pick

s^ =^ ½ and we can derive a spline equation More generally, we can use any tension parameter

−3 −2 s 2 3

− 0 2 0

0 »^ º

»^

º …^ »

…^

−1^0

…^ »

…^

»^

=^1 ¬^

¼^

…^ »

…^

2 −5^4

…^ »

…^

−1^3 −^

¬^

¼ ¬^ ¼

(^ )

i i i i

u^ u^

u^ u

p p

p^

p p^ −3 − 2 3

− 0 1

0 0 »^

»^

º …^ »

…^

−^0

0 …^ »

…^

»^

= 1¬^

¼^

…^ »

…^

2 − 3^ 3 − 2

−^ …^

…^

−^ 2 −^

¬^

¼ ¬^ ¼

(^ )

i i i i s^

s u^ u^

u^ u^ s^

s^ s

s s^ s^ s^

p p s

p^

p p

B-Splines Like Catmull–Rom splines, start with sequence of pointsCurves no longer interpolate control points^ • points where segments actually meet are called knots• for Hermite

et al^ the knots were always control points Lack of interpolation isn’t a big problem for interactive design^ • but it’s hard to predict curve just based on points coordinates

,^ ,^ p p! n 0 −3 − 2 3

− 1 4 1

0 »^ º

»^

º^ …^ »

…^

−3^0

…^ »

…^

»^

=^1 ¬^

¼^

…^ »

…^

3 −6^3

…^ »

…^

−1^3 −^

¬^

¼ ¬^ ¼

(^ )

i i i i

u^ u^

u^ u

p p

p^

p p

B-Spline Basis Functions

Non-negative functions^ • implies convex hull property (^ ) b u 1

(^ ) b u 3 (^ ) b u 4 (^ ) b u 2

(^ ) (^

) (^

) (^ ) b u^ u (^ ) b u^ u^ (^ ) (^ )

u b^ u^

u^ u^ u b^ u^ u

3 1 3

2 2

3 2 (^1) = 1− (^61) = (^3 )

− 6^ + 4 61 = −3 + 3^ + 3^ +1 61 = 6

(^ )^ (

)^ (^

)^ (^ )

i^ i^

i^ i b^ u^ b

u^ b^

u^ b^ u 1 −3^2

−2^3

−1^4 +^ +

p^ p

p^

p

Converting Between Cubic Spline Types We saw a specific example of Bézier–Hermite conversionSuppose we want to convert between two arbitrary splinesGiven geometry matrix

G^ find equivalent^1

Gfor other spline^2 1 1 2

=^2

T^ T u M G^ u M G^ −1^2 2

=^1

0 G M^ M G

0 3

1 0

2 3

3 (^1 0 0 0) » º

»^ º

»^

…^ »^

…^ »

…^

…^ »

…^

…^ »

…^

−3^3

…^ »^

…^ »

…^

0 0 −^

¬^

¬^ ¼^

¬^ ¼

p^

p p^

p r^

p r^

p

Drawing Spline Curves Method #1 — Direct evaluation^ • we have a function that generates points on the curve• vary parameter

u^ between 0 and 1

  • substitute into formula and compute a position• connect consecutive points with line segments Method #1a — Direct evaluation with forward differencing • instead of evaluating polynomials directly• incrementalize polynomial to cut down on multiplies This approach has some problems • uniform parameter spacing is not uniform in space• length of segments will vary over line• control over length is important– too long makes jagged curves; too short is too slow to draw

Bézier Curve Subdivision Subdividing control polyline^ • produces two new control polylines for each half of the curve• defines the same curve• all control points are closer to the curve• this is handy for drawing

u

u

1-u

1-u

Drawing Spline Curves Method #2 — Recursive subdivision^ • starting with initial control polyline, recursively subdivide• each subdivision produces points closer to curve• keep doing this until the segments are good enough– until they’re short enough (roughly constant line size)– or curve is locally flat enough (fewer lines in straight regions) And we only have to write this code once!^ • we’ve formulated a uniform representation for splines• all we need to know is the basis & geometry matrices

Linear Smoothing of Curves We are generally interested in symmetric weighting schemes

i^

i^ i^

i α

α α−

1−^

1− ≈^ ·^

≈^ · ′ =^

+^ + ∆^ ¸^

∆^ ¸ 2

2 «^ ¹^

«^ ¹ v^

v^ v^

v (^1 1 1) weights [ ] 4 2 4

Creating Smooth Curves by Subdivision Alternately repeat subdivision & smoothing operators^ • converges to some limit curve (determined by weights) For weights [¼ ½ ¼] resulting curve is piecewise B-spline!^0

1

2

3

4

Subdivision Level

Subdivision as Linear Operator Points after

k^ steps are linear combinations of previous points • can therefore write subdivision step as a matrix operation

k^ k^ k i i k i i

n^ n x^ y n^ n

x^ y x^ y^

x^ y x^ y

x^ y x^ y

−1^ − 1 1

1 1 2 2

(^2 2) − 2 +1^ 2 +1^2

= »^

º …^

»^ »^

º …^

»^ …^

» …^

»^ …^

»

…^

»^ …^

» …^

»^ …^

» …^

»^ ¬^

¼ …^

» ¬^

p^ S^ p # # S ¼

#^ # #^ #

Smoothing As Barycentric Averaging 1.^ Compute barycenters of adjacent edges2.^ Compute barycenter of barycentersSame as weights [¼ ½ ¼] but works in higher dimensions too

v^^ ii v i + v v^ i^ ′ v^ i