Interpolation Techniques Technical Background Reading Animation

27
© Möller/Parent/Machiraju Interpolation Techniques CMPT 466 Computer Animation Torsten Möller © Möller/Parent/Machiraju Technical Background • Interpolation Speed control along curve Representing and interpolating orientations Path following • Keyframing Free form deformations Global deformations © Möller/Parent/Machiraju Reading Chapter 3 of Parents book Foley, van Dam, etc.; Angel; Watt; Glassner; Hill; Baker + Hearns M. Mortensen, “Geometric Modeling” George Wolberg, “Digital Image Warping” © Möller/Parent/Machiraju Animation Techniques Key Frame Animation: – Position: Hermite Interpolation. Catmull-Rom Interpolation Bezier Interpolation. • ... – Orientation: Interpolation of Euler angles. Interpolation of Quaternions.

Transcript of Interpolation Techniques Technical Background Reading Animation

Page 1: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Interpolation Techniques

CMPT 466

Computer Animation

Torsten Möller

© Möller/Parent/Machiraju

Technical Background

• Interpolation

• Speed control along curve

• Representing and interpolating orientations

• Path following

• Keyframing

• Free form deformations

• Global deformations

© Möller/Parent/Machiraju

Reading

• Chapter 3 of Parents book

• Foley, van Dam, etc.; Angel; Watt;

Glassner; Hill; Baker + Hearns

• M. Mortensen, “Geometric Modeling”

• George Wolberg, “Digital Image

Warping”

© Möller/Parent/Machiraju

Animation Techniques

• Key Frame Animation:

– Position:

• Hermite Interpolation.

• Catmull-Rom Interpolation

• Bezier Interpolation.

• ...

– Orientation:

• Interpolation of Euler angles.

• Interpolation of Quaternions.

Page 2: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Animation Techniques

• Path Animation:

– Uniform speed parameterization.

– Tangent guided rotation.

© Möller/Parent/Machiraju

Interpolation and Keyframing

• Much of animation is interpolation!

• Abstract out important features of animation

• Subjective ! the appropriate feature

• Animator specifies information (low level

of abstraction).

© Möller/Parent/Machiraju

Examples - Keyframing

• 2D/Hand-Drawn/Cel Animation

– Highly skilled animator draws theimportant, or key frames

– Less skilled animator draws theinbetween frames

• 3D/Computer Generated Animation

– Animator specifies the importantkey frames

– Computer generates the in-betweensautomatically using interpolation

© Möller/Parent/Machiraju

Interpolation

• Generating in between values (connecting

the dots)

Page 3: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Example Interpolation

© Möller/Parent/Machiraju

Interpolation

• Interpolate position of a point in space.

• We can interpolate any changeable value!!!

– position

– orientation

– Color (sunrise)

– Intensity (dimmed lights)

– camera focal length (zoom)

• Non-trivial -

– appropriate parameterization of position,

– appropriate interpolating function,

– Maintain desired control of the interpolation over time.

© Möller/Parent/Machiraju

Functions

– Read Appendix B.4

– Explicit equation: y = f(x)

• Dependent on choice of coordinate axes

• Not defined if more than one f(x) for x, sqrt(9)

– Implicit equation: f(x, y) = 0

• Quick to see if (x,y) is on curve

• Difficult to generate series of f(x) for x:0…10

– Parametric: x = f(t), y = f(t)

© Möller/Parent/Machiraju

Interpolation Function

• How smooth theresulting functionneeds to be(i.e. continuity),

Page 4: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Continuity

• Zeroth-order (C0):

the value of the function f(x0) is arbitrarily

close to the value of f(x0+!)

• First-order (C1):

first derivative is continuous

• Second-order (C2):

second derivative is continuous

© Möller/Parent/Machiraju

Interpolation Function

• Computational expense - order of

interpolating polynomial

• Local or global control of the interpolating

function

© Möller/Parent/Machiraju

interpolation

approximation

Interpolation vs Approximation

• Actual values at key frames (interpolation)

Or

• Control interpolating function and do not

represent actual values (approximation).

© Möller/Parent/Machiraju

Choices

• Interpolation v.

approximation

• Computational

complexity

• Local v. global control

• Continuity

• Match data vs. design

• Cubic

• Local

• 1st order (tangential)

Page 5: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Linear Interpolation

or

!

P(u) = (1" u) # P0

+ u # P1

!

P(u) = F0(u) " P

0+ F

1(u) " P

1!

P(u) = (P1" P

0) # u + P

0

!

P(u) =F0(u)

F1(u)

"

# $

%

& ' P0 P

1[ ] = FBT

For generic blending functions:

Matrix forms:

P0

P(u)

P1

!

P(u) = u 1[ ]"1 1

1 0

#

$ %

&

' ( P0

P1

#

$ %

&

' ( =U

TMB

© Möller/Parent/Machiraju

u=1/3

u=2/3

u=0.0

u=1.0

x = f(u)

y = g(u)

z = h(u)

Curves (1)

• Parametric form: P = P(u) = (x,y,z)

• Space-curve: P = P(u) 0.0 <=u<=1.0

© Möller/Parent/Machiraju

Curves (2)

• 4-point form

u=1/3

u=2/3u=0.0

u=1.0

!"#$%&%'(#)%*%+(#,%*%-(#%*%.

!"/0/$%&%%.%&%!/

!"12)$%&%'("12)$)%*%+("12)$,%*%-("12)$%*%.%&%!1

!",2)$%&%'(",2)$)%*%+(",2)$,%*%-(",2)$%*%.%&%!,

!"10/$%&%'%*%+%*%-%*%.%&%!)

© Möller/Parent/Machiraju

Curves (3)

P1

P2

P3

P4

P(u) u3 u 1u2 M

P(u) = u3*( m00*P1 + m01*P2 + m02*P3 + m03*P4) +

u2*( m10*P1 + m11*P2 + m12*P3 + m13*P4) + …

General Matrix Form

!"#$%&%34%5%6

Derivatives!7"#$%&%374%5%6

Page 6: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Curves (4)

Problem – more than 4 points ?

How we do approach this ?

© Möller/Parent/Machiraju

Piecewise Curve Segments

• One curve constructed by connecting many

smaller segments end-to-end

• Piecewise linear: a sequence of straight line

segments

• Continuity describes the joint

© Möller/Parent/Machiraju

Curves (5)

• Hermite

• Bezier

• Catmull-Rom

• Blended parabolas

• B-splines, NURBS

© Möller/Parent/Machiraju

Hermite

• Hermite Form P0

P1

P’0P’1

!"#$%&%'(#)%*%+(#,%*%-(#%*%.

!"/0/$%&%%.%&%!/!"10/$%&%'%*%+%*%-%*%.%&%!1!7"/0/$%&%%-%&%!7/!7"10/$%&%%)('%*%,(+%*%-%&%!71

M matrix ?

Page 7: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Catmull-Rom

• P’ i= 0.5( Pi+1 - Pi-1)

• Other ways – do not use 0.5

• Use ratio of lengths of segments

(Pi-1,Pi) and (Pi,Pi+1)

• End conditions specified

separately

• Interpolating spline

• Make drawing and editing easy

• Often used in animation path movement

© Möller/Parent/Machiraju

Bezier(1)

© Möller/Parent/Machiraju

Ex:

Bezier (2)

• Named after French engineer Pierre Bezier

• Direct control over the location of the

• curve with anchor points

• Difficult: off-path control points

© Möller/Parent/Machiraju

u=1/3

P(1/3)

Bezier(3)

• De Casteljau construction of Bezier curve

Page 8: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Blended Parabolas

Order ?

© Möller/Parent/Machiraju

Splines

• Created by fitting a curve to a set of Control

Points

– Artist places points, and program creates curve based

on points

– Polyline

• series of straight lines through the points

– B-splines

• blend position of control points without passing through any of

them

• Bezier is a special case

– Non-uniform rational B-splines (NURB)

© Möller/Parent/Machiraju

Splines

• Control Points

– influence the curve’s shape

• Knots

– Control points lying the curve

• Interpolating Splines

– Curves passing through controlpoints (knots)

• Approximating Splines

– Control points influencing shape

© Möller/Parent/Machiraju

B-Spline / NURBS

Page 9: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Motion along a Curve

• Attach variable (e.g., position) /object to a

curve

• Allow parametric curve P(u) and compute

p=P(u)

• Technically, each coordinate can be

controlled separately

© Möller/Parent/Machiraju

t

f(t)

"t "t

Motion along a curve

• Want to step in equal increments of u

• Want to ensure constant change in u implies

constant change in P(u)

• Does not always happen

© Möller/Parent/Machiraju

Example

© Möller/Parent/Machiraju

A, t=0

B, t=10

C, t=35

D, t=60

Problem Specification

• Frame Number, position – time motionspecification

• Specify relative velocities – specify accelerationsetc.

• A space curve is a cubic equation for example "

• Sweeping of curve changes animation (constant) --- distance time function

Page 10: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Arc Length

• Arc length is the distance along the curve

• To ensure constant speed of curve

evaluation, perform arc length

parameterization of curve

© Möller/Parent/Machiraju

Arc Length Parameterization

• Offline methods

• Three ways

– Analytical computation

– Table based

• Supersampling and summed linear distances

• Gaussian quadrature

© Möller/Parent/Machiraju

Arc Length Parameterization

• Given parameters u1 and u2, findLENGTH(u1, u2)

• Given an arc with length s and a parameteru1, find u2 s.t. LENGTH (u1, u2) = s

• Can we compute s = G(u) = distance fromstart of curve to point at u?

• If so, G-1 is used to build arc lengthparameterized curve: P(G -1(s))

• Cannot be done for all curves – e.g., splines

© Möller/Parent/Machiraju

w=0.3 w=0.6

w=0.0

w=1.0u=0.2 u=0.5

* relative arclength

Space-Time Curve

• Given arclength* w, find u such that

P = P(u)

• where w = arclength(P(0.0), P(u))

Page 11: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Analytic Computation

( )!! ===

=

2

1

22

1

/)2,1(

)(

u

u

u

u

dududPdudu

dPsuulength

uPx

( )! ++=

++=

+++=

2

1

22

2

23

23

23/

)(

u

u

ducbuaus

cbuaududP

dcubuauuP

Cubic curve example:

( ) ( ) ( ) 222

!"

#$%

&+!

"

#$%

&+!

"

#$%

&=

du

udz

du

udy

du

udx

du

dP

© Möller/Parent/Machiraju

Forward Differencing

• Sample curve at many parameter values

• Create piecewise linear representation of

curve from parameter evaluations

© Möller/Parent/Machiraju

P(0.0)

P(0.1)

P(0.2) P(0.3)

P(0.4)

Forward Differencing

• Calculate by over sampling

© Möller/Parent/Machiraju

U

0.1

0.2

0.3

0.4

...

Distance

0.08

0.19

0.32

0.45

...

distance

Estimated u

Forward Differencing

• Calculate by forward differencing

Page 12: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Forward Differencing

• (once again) Compute linear distance

between samples

• Store distances in table (Table 3.1)

• Use table lookup & linear interpolation to

access all values

• Limitations/Shortcomings? No error control

© Möller/Parent/Machiraju

Adaptive Approach

• Adaptively subdivide

• First step, compare:

– length (start, middle) + length (middle, end)

– length (start, end)

• If error is too large, subdivide

• Use link list to store data

© Möller/Parent/Machiraju

Method 2- Numerical Comp.

• Numerical methods exist to approximate

integral of curve given sample

points/derivatives

• Instead of using sum of linear segments, use

numerical method to compute sum of

curved segments

© Möller/Parent/Machiraju

!" =# i

ii ufwuf )()(

1

1

Gaussian Quadrature

• Commonly used to integrate function

between –1 and +1

• Function to be integrated is evaluated at

fixed points within [-1, 1] and multiplied by

a pre-calculated weight

• More sample points leads to better accuracy

Page 13: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Gaussian Quadrature

• Compute arc length of cubic curve

• Adaptive Gaussian integration monitors errors to

subsample

• Build a table that maps parameter values to arc

length values

• solve arc length at u, find ui and ui+1 that bound u

• Use gaussian quadrature to compute intermediate

arc length between that at ui and ui+1

© Möller/Parent/Machiraju

)(

)(

1

11

!

!!

"!=

n

nnn

pf

pfpp

u given s?

• Compute u s.t. length (u1, u) = s

• Solve: s – length(u1, u) = 0

• Newton-Raphson does this for us:

• f = s – length(u1, pn-1)

f’= dp/du evaluated at pn-1

© Möller/Parent/Machiraju

Newton-Raphson

• Be aware that Newton-Raphson could set pn

to a value not defined by curve

• f’(pn-1) could be 0 (divide by 0)

© Möller/Parent/Machiraju

slow

slowfast

Controlling Motion Along A

Curve

Page 14: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Speed Control

• Equal arc length – constant speed

• Other speeds?

• Smooth motion – accelerates from stopposition, reaches maximum velocity,deaccelerates

• Input – time, Output – arc length/distance

• Relate time to arc length – ease-in/ease-outcontrol or a new function : ease(t)

• Space curve, ease(t) - different

© Möller/Parent/Machirajut

s(t)

(2-t)t

Speed Control

• Given arc-length parameterized curve

• s(t) distance the curve has traveled given t

– Normalize total distance to 1

– Monotonic increasing and continuous

• To ease in/out, make s(t) = ease (t) that

looks like:

© Möller/Parent/Machiraju

Q(t)

Equal t

Ease-in, ease-out motion

• Arc length no longer proportional to time

© Möller/Parent/Machiraju

s1

s0

s

tEase-in

Ease-out

Where ?s

Ease Curves – Dist. Time Func

• Velocity curve maps time to arc length

Page 15: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Speed Control

Easing in/out:

22

2

12

sin

)()(

!!

!!

""#

+$%

&'(

)#*

==

t

t

teasets

Speed never constant !© Möller/Parent/Machiraju

Need continuous in derivative

Sinusoidal segments

Linear segment

Sinusoidal End Segment

© Möller/Parent/Machiraju

t

vel(t)

t1 t2

v0

Speed Control

• Sine functions are expensive

– Table lookups,

– Make one up

– acceleration period, deceleration period, and

max velocity

© Möller/Parent/Machiraju

acceleration

time

t1 t2

0.0 1.0

Same area

Velocity ?

Constant Acceleration

Page 16: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

velocity

timet1 t2

Constant Acceleration (2)

© Möller/Parent/Machiraju

s3

Q u( )

t

s

1

2

V t u s u( ( ), ( ))

Velocity Curve

Velocity Curves

© Möller/Parent/Machiraju

distance

time

Parabolic segments

Constant Acceleration (3)

© Möller/Parent/Machiraju

tt1 t2

v0

)0.1(2

1)(

2

10.1 2012010 tvttvtv !""+!"+""=

21101

0

1

1

2

0

)(2

0.02

tttttvt

vd

ttt

tvd

<<!"+"=

<<"

"=

Speed Control

• Distance traveled is area under curve

• User selects two of three unknowns and

distance traveled constraint determines third

• Integrate velocity function to find s(t)

Page 17: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Q u( )

Position Spline

t

s

Velocity Curve

Equal time

Intervals

Gentle

Acceleration

from Rest

Gentle deceleration

to Rest

Velocity Curves

© Möller/Parent/Machiraju

Quaternions

i

j

k

A quaternion is made up of a scalar

plus a vector:

q a b c d= + + +i j k

We use the notation: q s

s a

b c d

q q s s s s

q s

qq q s

=

=

= + +

= ! " + + #

= !

= = +

( , )

( , )

( , )

v

v i j k

v v v v v v

v

v

where:

1 2 1 2 1 2 1 2 2 1 1 2

2 2 2

Multiplication is

defined:

Sum ?

© Möller/Parent/Machiraju

Quaternions

Take a pure quaternion (one that has no scalar part): p = ( , )0 r

And a unit quaternion: q = =(cos ,(sin ) )! ! n n where: 1

Define: R p qpq qpq qq( ) = =

!1 (for of unit magnitude)

R p

R p

q

q

( ) ( ,(cos sin ) sin ) cos sin

( ) ( , (cos ) ( cos ) ) (sin ) )

= ! + " + #

= + ! " + #

0 2 2

0 2 1 2 2

2 2 2$ $ $ $ $

$ $ $

r n(n r n r

r n(n r n r

(cos , sin ) ( , ) (cos , sin ) ( , ')! ! ! !

2 2 2 20 0n r n r" =

r n r' ( , )= R !r

© Möller/Parent/Machiraju

Review of Quaternion Rotations

Rotq(v) = v’ = q * [0,v] * q-1

Rotq(v) = Rotk*q(v)

Rotqp(v) = Rotq(Rotp(v) )

Rot[s,v] == Rot[-s,-v]

Page 18: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Quaternion: Power Operator

[ cos(#/2), sin(# /2) * A] $ [cos($#/2), sin($# /2) * A]=

q $ rotates to q orientation

as $ goes from 0 to 1

q $ and (-q) $ give different rotation sequences

0< # < % gives short sequence; % < # <2 % gives long one

Since first term in q is cos(#/2), q gives short sequence if

first term is positive

© Möller/Parent/Machiraju

Quaternions

• Quaternions are points on the unit sphere in

four dimensions

– Unit sphere in three dimensions plus a fourth

dimension representing the rotation about the

normal at a point on the sphere

• Interpolating quaternions

© Möller/Parent/Machiraju

Quaternions on a 4D sphere

• Unit quaternion: q=(s,x,y,z), ||q|| = 1

Want equal increment along arc connecting two

quaternions on surface of sphere

spherical linear interpolation

© Möller/Parent/Machiraju

Quaternions as points on a 4D

sphere (2)

Remember: Rot[s,v] == Rot[-s,-v]

Use quaternion representations

that are ‘close’ to each other:

Page 19: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Interpolating Examples

© Möller/Parent/Machiraju

Interpolating Examples

Pictures from page 367

© Möller/Parent/Machiraju

Linear Interpolation

Euler Angles: [x,y,z] = (1- $)[xa,ya,za] + $[xb,yb,zb]

K = (1-a) A + a BScalar: (lerp)

Quaternions?: Linear interpolation of quaternion

values would give unequal

rotation increments

© Möller/Parent/Machiraju

Interpolation of Rotations

Euler Angles: [x,y,z] = (1-$)[xa,ya,za] + $[xb,yb,zb]

K = (1-$) A + $ BScalar: (lerp)

Quaternions: q = (qbqa-1) a qa (slerp)

q = slerp(qa,qb, a)

Page 20: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

SLERPing

• Linear interpolation doesn’t produce constant velocity

interpolation of quats

• Instead, interpolate along the arc on sphere between two

quats

© Möller/Parent/Machiraju

SLERPing

• SLERP:

• Unit quaternion is not guaranteed

• What about continuity of interpolation? – first order

discontinuity !

2121 )/(sin))(sin()/(sin)))1((sin((),,( ququuqqslerp !!+!!"= ####

© Möller/Parent/Machiraju

SLERPing

• Which way do we go?

– Long way or short way around sphere

• q = [s,v] = [-s,-v] = -q

• Compute angle between q1 and q2

– Four dimensional dot product

• cos(#)= q1.q2 = s1*s2 + v1 .v2

– If positive, this is shortest,

– Else, interpolate between q1 and -q2

© Möller/Parent/Machiraju

Continuity of SLERP

• Interpolate between points

– [p0, …, pn-1, pn, pn+1, …]

• Bezier interpolation would compute intermediate points for each pn

– To define tangent at pn

– Define bn to be point before pn

– Define an to be point after pn

Page 21: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Midpoint of Quaternions

• q1 + q2 = [s1,x1,y1,z1] + [s2,x2,y2,z2]

• Spherical linear interpolation (slerp)

© Möller/Parent/Machiraju

Spherical Linear Interpolation

• Slerp(q1,q2,u) =((sin((1-u)#)/sin(#)) q1 + (sin(u #)/sin #)q2

• Where cos # = q1.q2

© Möller/Parent/Machiraju

Spherical Linear Interpolation of

Quaternion

© Möller/Parent/Machiraju

Bezier Interpolation of

Quaternions

Page 22: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Quaternion Interpolation

• Automatically generating interior

(spherical) control points

P n-1

P n

P n+1

Q n

A n

Double the arc

Bisect the span

© Möller/Parent/Machiraju

Quaternion Interpolation

• Double(p,q) = p.q-1.p

• Q n =Double(P n-1, P n)

P n-1

P n

Q n

© Möller/Parent/Machiraju

Construct Midpoint

• Bisect(p,q) = (p+q)/||p+q||

• A n =Bisect(Q n, P n+1)

P n-1

P n

P n+1

Q n

A n

© Möller/Parent/Machiraju

Bezier interpolation

• De Casteljau construction of Bezier curve

u=1/3

P(1/3)

Page 23: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Continuity of SLERP

• To compute midway (average) points between quaternions,

SLERP halfway

• Instead of adding vectors, concatenate rotations

an bn+1

qn+1qn

P1 = slerp(qn, qn, 1/3)

P2 = slerp(an, bn+1, 1/3)

P3 = slerp (bn+1, qn+1, 1/3)

P12 = slerp (p1, p2, 1/3)

P23 = slerp (p2, p3, 1/3)

P = slerp (p12, p23, 1/3)

© Möller/Parent/Machiraju

Animating with Quaternions

• Given quaternion representations,

interpolate through them

– Cubic, interpolating

• Use operations efficient with quaternion

representation

– Halfway between 2 quaternions

– Linear interpolation

© Möller/Parent/Machiraju

Following a Path

• How do we compute an object’s first-personview as it follows a path?

– Situate a local coordinate system about theobject and orient the system

• Positive z-axis points frontward

– Frontward is first derivative, P’(s)

• Positive y-axis points upward

– Upward is cross product of z-axis and P’’(s)

• Positive x-axis points left

– Cross product of z- and y-axes

© Möller/Parent/Machiraju

Path Following

• Frenet Frame

• uvw coord. system or

• tbn system

Page 24: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Frenet Frame

• The local coordinate system

• If curve has no curvature, technique fails

– Use Frenet Frame from before straight section

starts (and interpolate rotation about w-axis if

necessary)

• Use dot product of v-axis before and after straight

section to determine interpolation amount

© Möller/Parent/Machiraju

Curvature Continuity

=0

© Möller/Parent/Machiraju

Frenet Frame

• Discontinuity in the curvature causes jump in localcoordinate system

• Can be jumpy if curve is not very smooth

• Doesn’t reflect desirable camera effects likebanking into a corner

• A curve that moves downward in 3-space willcause Frenet frame to orient upside-down

© Möller/Parent/Machiraju

Alternative Orientation

• Define a natural notion of ‘UP’, y-axis

– The opposite direction of gravity

Page 25: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Alternative Orientation

• Define a COI point, w-axis

– w = COI – POS

– u = w x UP

– v = u x v

© Möller/Parent/Machiraju

Alternative Orientation

• Passing close to COI causes extreme changes

• How do you automatically update focal point?

© Möller/Parent/Machiraju

Lookahead

• If POS = p(s), the COI = p(s+&s)

– Note, should be arc length parameterized to prevent

wandering camera

• What about the end of curve (where s+&s is undefined)?

– Extrapolate curve in the direction of its tangent

© Möller/Parent/Machiraju

Tangents ?

• Not always intuitive

Page 26: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Smoothing Data

• Frequently we use a series of points to

represent paths

• We turn points into piecewise Bezier curve

• But may be overkill

• Alternatives

© Möller/Parent/Machiraju

Smoothing Data

• Average, convolve a point with its neighbors

– This may causes flattening of curves

• Fit cubic curve to subsets of points

– Curve is inherently smooth

– Sample curve at midpoint for new point

• Least square fit

11

11

4

1

2

1

4

1

2

2+!

+!

++=

++

="iii

ii

i

iPPP

PPP

P

© Möller/Parent/Machiraju

Convolution Kernels

• Another smoothing technique

• Imagine data define stepwise function

• Create the kernel

– Centered around zero

– Symmetric

– Has finite support

– Area under curve equals 1

Box

GaussianTent

© Möller/Parent/Machiraju

• Compute new (averaged) points by convolvingkernel with data

• Slide kernel over all points

• Watch for overlap at beginning and end

New value for P1 is:

! "2

0

Overlap) of (AreaP

P

P

Convolution Kernels

Page 27: Interpolation Techniques Technical Background Reading Animation

© Möller/Parent/Machiraju

Example

© Möller/Parent/Machiraju

Cubic Curves

• P(u) = au3 + bu2 + cu + d

• For a point, Pi, build curve from its four

neighbors

– Pi-2, Pi-1, Pi+1, Pi+2

– Evaluate the cubic at its midpoint (u = 0.5)

– Average cubic midpoint and Pi

© Möller/Parent/Machiraju

Example

© Möller/Parent/Machiraju

Evaluating the Cubic

• Pi-2 = P(0) = d

• Pi-1 = P(1/4) = a 1/64 + b 1/16 + c1/4 + d

• Pi+1 = P(3/4) = a 27/64 + b 9/16 + c3/4 + d

• Pi+2 = P(1) = a + b + c + d

• 4 equations and 4 unknowns… solve