29.01.2014 Views

Barycentric coordinates and transfinite interpolation

Barycentric coordinates and transfinite interpolation

Barycentric coordinates and transfinite interpolation

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Barycentric</strong> <strong>coordinates</strong> <strong>and</strong> <strong>transfinite</strong><br />

<strong>interpolation</strong><br />

Michael Floater<br />

Centre of Mathematics for Applications,<br />

Department of Informatics,<br />

University of Oslo


In this talk:<br />

1. <strong>Barycentric</strong> <strong>coordinates</strong><br />

2. Generalization to polygons: Wachspress, mean value, etc.<br />

3. Transfinite <strong>interpolation</strong>


<strong>Barycentric</strong> <strong>coordinates</strong> on a triangle<br />

v 3<br />

T<br />

x<br />

v 1<br />

v 2<br />

Given x ∈ T , want λ 1 , λ 2 , λ 3 ≥ 0 such that<br />

λ 1 + λ 2 + λ 3 = 1,<br />

<strong>and</strong><br />

λ 1 v 1 + λ 2 v 2 + λ 3 v 3 = x.


Linear system of three equations,<br />

⎛ ⎞ ⎛ ⎞ ⎛ ⎞<br />

1 1 1 λ 1 1<br />

⎝v1 1 v2 1 v3<br />

1 ⎠ ⎝λ 2<br />

⎠ = ⎝x 1 ⎠ .<br />

v1 2 v2 2 v3<br />

2 λ 3 x 2<br />

By Cramer’s rule, unique solution is<br />

λ 1 = A 1<br />

A , λ 2 = A 2<br />

A , λ 3 = A 3<br />

A .<br />

v 3<br />

A<br />

A 2<br />

x<br />

A 3<br />

A 1<br />

v 1<br />

v 2


Properties<br />

◮ Lagrange property: λ i (v j ) = δ ij .<br />

◮ Interpolation: if<br />

g(x) =<br />

3∑<br />

λ i (x)f (v i ),<br />

i=1<br />

then g(v i ) = f (v i ).<br />

◮ Linear precision: if f is linear then g = f .<br />

◮ Linearity: λ i is linear.<br />

◮ Bernstein-Bezier basis for polynomials, degree d:<br />

p(x) =<br />

∑<br />

i+j+k=d<br />

n!<br />

i!j!k! λi 1(x)λ j 2 (x)λk 3(x)c ijk .


<strong>Barycentric</strong> <strong>coordinates</strong> on polygons<br />

Let Ω be a convex polygon.<br />

v 4<br />

v 3<br />

v 5<br />

v 1 v 2<br />

Functions λ i : Ω → R, i = 1, . . . , n, are barycentric <strong>coordinates</strong> if<br />

for x ∈ Ω, λ i (x) ≥ 0, i = 1, . . . , n, <strong>and</strong><br />

n∑<br />

λ i (x) = 1,<br />

i=1<br />

n∑<br />

λ i (x)v i = x.<br />

i=1


Properties<br />

◮ Lagrange property: λ i (v j ) = δ ij .<br />

◮ Interpolation: if<br />

n∑<br />

g(x) = λ i (x)f (v i ),<br />

i=1<br />

then g(v i ) = f (v i ).<br />

◮ Linear precision: if f is linear then g = f .<br />

◮ λ i lies between the two functions:<br />

1<br />

1<br />

0<br />

0<br />

0<br />

0<br />

0<br />

0<br />

◮ Generalized Bernstein-Bezier:<br />

p(x) = ∑ ( ) d<br />

λ i 1<br />

i 1<br />

(x) · · · λ in n (x)c i .<br />

|i|=d<br />

0<br />

0<br />

0<br />

0


Coordinates for quadrilaterals<br />

v 01<br />

v 11<br />

x<br />

v 00<br />

v 10<br />

Can find λ, µ ∈ [0, 1] s.t.<br />

x = (1 − λ)(1 − µ)v 00 + λ(1 − µ)v 10 + (1 − λ)µv 01 + λµv 11 ,<br />

giving an interpolant<br />

g(x) = (1 − λ)(1 − µ)f 00 + λ(1 − µ)f 10 + (1 − λ)µf 01 + λµf 11 .


To find λ <strong>and</strong> µ: let<br />

a = v 00 −x, b = v 10 −v 00 , c = v 01 −v 00 , d = v 00 −v 10 −v 01 +v 11 .<br />

Then need to solve<br />

a + bλ + cµ + dλµ = 0.<br />

Eliminating λ gives a quadratic in µ:<br />

(a + cµ) × (b + dµ) = 0.<br />

Similar for λ. The special cases c × d = 0 <strong>and</strong> b × d = 0 need to<br />

be treated separately.


Wachspress <strong>coordinates</strong>: Wachspress 1973, Warren 1996<br />

v i+1<br />

x<br />

v i<br />

v i−1<br />

For a convex polygon, n vertices, let<br />

λ i (x) =<br />

w i (x)<br />

∑ n<br />

j=1 w j(x) , w i(x) =<br />

Then λ 1 , . . . , λ n are barycentric <strong>coordinates</strong>.<br />

A(v i−1 , v i , v i+1 )<br />

A(x, v i−1 , v i )A(x, v i , v i+1 ) .


Proof: Meyer et al. 2002<br />

Let<br />

A i = A(x, v i , v i+1 ) <strong>and</strong> B i = A(v i−1 , v i , v i+1 ).<br />

Then express x as<br />

<strong>and</strong> rearrange:<br />

x = A i<br />

v i−1 + (B i − A i−1 − A i )<br />

v i + A i−1<br />

v i+1 ,<br />

B i B i<br />

B i<br />

B i<br />

(v i − x) = 1 (v i − v i−1 ) − 1 (v i+1 − v i ).<br />

A i−1 A i A i−1 A i<br />

Summing both sides over i gives<br />

∑ B i<br />

(v i − x) = 0<br />

A i−1 A i<br />

or<br />

i<br />

∑<br />

w i (x)(v i − x) = 0.<br />

i


Wachspress <strong>coordinates</strong> are rational<br />

λ i (x) =<br />

B i<br />

∑<br />

k B k<br />

∏<br />

j≠i−1,i A j(x)<br />

∏<br />

j≠k−1,k A j(x)<br />

=<br />

degree (n − 2)<br />

degree (n − 3) .


Application: barycentric mappings<br />

Recipe: given x ∈ Ω,<br />

1. express x in Wachspress form x = ∑ i λ i(x)v i ,<br />

2. set x ′ = ∑ i λ i(x)v ′ i .


Application: curve deformation


Theorem (F. & Kosinka). Wachspress mappings are injective<br />

Idea of proof: express Jacobian as<br />

∣<br />

∑<br />

λ i λ j λ k ∣∣∣∣∣<br />

J = 2<br />

∂ 1 λ i ∂ 1 λ j ∂ 1 λ k A(v i, ′ v j, ′ v k ′<br />

1≤i


Mean value <strong>coordinates</strong><br />

v i+1<br />

v i<br />

x<br />

α i<br />

α i−1<br />

v i−1<br />

For a convex polygon, n vertices, let λ i (x) = w i (x)/ ∑ n<br />

j=1 w j(x),<br />

where<br />

w i (x) =<br />

(<br />

1<br />

tan<br />

‖v i − x‖<br />

(<br />

αi−1 (x)<br />

2<br />

)<br />

+ tan<br />

Then λ 1 , . . . , λ n are barycentric <strong>coordinates</strong>.<br />

(<br />

αi (x)<br />

2<br />

))<br />

.


Proof:<br />

With e i = (v i − x)/‖v i − x‖, need to show that<br />

or<br />

n∑ (<br />

tan(αi−1 /2) + tan(α i /2) ) e i = 0,<br />

i=1<br />

n∑<br />

tan(α i /2)(e i + e i+1 ) = 0. (1)<br />

i=1<br />

To show this, let e i = (cos θ i , sin θ i ). Then α i = θ i+1 − θ i , <strong>and</strong> so<br />

( αi<br />

)<br />

( αi<br />

)<br />

tan (e i + e i+1 ) = tan (cos θ i + cos θ i+1 , sin θ i + sin θ i+1 )<br />

2<br />

2<br />

= (sin θ i+1 − sin θ i , cos θ i − cos θ i+1 ).<br />

Summing this over i = 1, . . . , n gives (1).


Application: mesh parameterization


Transfinite <strong>interpolation</strong>, Warren et al 2004<br />

c ( t i+1 )<br />

c ( t i)<br />

For convex curve c : [a, b] → R 2 sample points v i = c(t i ) <strong>and</strong> take<br />

limit of Wachspress interpolants as max i (t i+1 − t i ) → 0. Gives a<br />

‘<strong>transfinite</strong> interpolant’<br />

∫ /<br />

b<br />

∫ b<br />

g(x) = w(x, t)f (c(t)) dt w(x, t) dt,<br />

a<br />

where w(x, t) = (c ′ (t) × c ′′ (t))/((c(t) − x) × c ′ (t)) 2 .<br />

a


MV <strong>transfinite</strong> <strong>interpolation</strong><br />

c ( t i+1 )<br />

c ( t i)<br />

Analogously, the <strong>transfinite</strong> MV interpolant is<br />

∫ /<br />

b<br />

∫ b<br />

g(x) = w(x, t)f (c(t)) dt w(x, t) dt,<br />

a<br />

a<br />

where<br />

w(x, t) = (c(t) − x) × c′ (t)<br />

‖c(t) − x‖ 3 .


Examples of MV interpolants


Non-convex curves? Angle formulation<br />

p ( x, θ)<br />

x<br />

θ<br />

For a convex curve, the MV interpolant is<br />

g(x) =<br />

∫ 2π<br />

0<br />

/ ∫<br />

f (p(x, θ))<br />

2π<br />

‖p(x, θ) − x‖ dθ 1<br />

‖p(x, θ) − x‖ dθ.<br />

0


On arbitrary curves<br />

p ( x, θ)<br />

2<br />

p 3<br />

( x, θ)<br />

p 1<br />

( x, θ)<br />

x<br />

θ<br />

where<br />

g(x) =<br />

∫ 2π<br />

0<br />

n(x,θ)<br />

∑<br />

j=1<br />

φ(x) =<br />

Hormann: φ(x) > 0.<br />

/<br />

(−1) j−1<br />

‖p j (x, θ) − x‖ f (p j(x, θ)) dθ φ(x),<br />

∫ 2π<br />

0<br />

n(x,θ)<br />

∑<br />

j=1<br />

(−1) j−1<br />

‖p j (x, θ) − x‖ dθ.


Application: image warping, Hormann


Application: mesh deformation, Ju, Schaefer, Warren


Hermite <strong>interpolation</strong><br />

Two methods:<br />

◮ Use MV weight function (with Chris Dyken / Solveig Bruvoll)<br />

◮ Radial minimization (with Christian Schulz)


Method 1: weight function<br />

The cubic interpolant p to the data f (0), f ′ (0), f (1), f ′ (1), can be<br />

expressed as<br />

p(x) = g 0 (x) + ψ(x)g 1 (x),<br />

where<br />

g 0 (x) = (1 − x)f (0) + xf (1),<br />

ψ(x) = x(1 − x),<br />

g 1 (x) = (1 − x)m 0 + xm 1 ,<br />

<strong>and</strong><br />

m 0 = f ′ (0) − f (1) + f (0), m 1 = −f ′ (1) + f (1) − f (0).


In R n we interpolate the data f <strong>and</strong> ∂f<br />

∂n<br />

on ∂Ω by the function<br />

p(x) = g 0 (x) + ψ(x)g 1 (x), x ∈ Ω,<br />

where<br />

<strong>and</strong><br />

m(y) =<br />

∫<br />

/<br />

f (p(x, v))<br />

g 0 (x) =<br />

S ‖p(x, v) − x‖ dv φ(x),<br />

/<br />

ψ(x) = 1 φ(x),<br />

∫<br />

g 1 (x) =<br />

S<br />

/<br />

m(p(x, v))<br />

‖p(x, v) − x‖ dv φ(x),<br />

∫<br />

φ(x) =<br />

1<br />

‖p(x, v) − x‖ dv.<br />

S<br />

( ∂f<br />

∂n (y) − ∂g 0<br />

∂n (y) ) / ∂ψ<br />

∂n (y),<br />

y ∈ ∂Ω.


To use this construction we need to find ∂ψ<br />

∂n (y) <strong>and</strong> ∂g 0<br />

∂n (y).<br />

Theorem<br />

If d(M E , ∂Ω) > 0 <strong>and</strong> d(M I , ∂Ω) > 0 <strong>and</strong> y ∈ ∂Ω then<br />

∂ψ<br />

∂n (y) = 1 ,<br />

V n−1<br />

∂g 0<br />

∂n (y) = 1 f (p(y, v)) − f (y)<br />

V n−1<br />

∫H(n) ‖p(y, v) − y‖<br />

dv,<br />

where V n−1 is the volume of the unit sphere in R n−1 : V 1 = 2,<br />

V 2 = π, V 3 = 4π/3, V 4 = π 2 /2,...


Hermite examples


Method 2: radial minimization<br />

MV <strong>interpolation</strong> revisited: the value g(x) is the unique minimizer<br />

a = g(x) of the local ‘energy’ function<br />

where<br />

∫<br />

E x (a) =<br />

q x,v (r) =<br />

<strong>and</strong> ρ(x, v) = ‖p(x, v) − x‖.<br />

S<br />

∫ ρ(x,v)<br />

0<br />

(<br />

q<br />

′<br />

x,v (r) ) 2 dr dv,<br />

ρ(x, v) − r<br />

a +<br />

r f (p(x, v)),<br />

ρ(x, v) ρ(x, v)


Hermite <strong>interpolation</strong><br />

Find a ∈ R <strong>and</strong> b ∈ R n that minimize<br />

∫ ∫ ρ(x,v) (<br />

E x (a, b) =<br />

q<br />

′′<br />

x,v(r) ) 2 dr dv,<br />

where q x,v is the cubic polynomial such that<br />

S<br />

0<br />

q x,v (0) = a,<br />

q ′ x,v(0) = v · b,<br />

q x,v (ρ(x, v)) = f (p(x, v)),<br />

q ′ x,v(ρ(x, v)) = D v f (p(x, v)),<br />

<strong>and</strong> set g(x) = a.<br />

Has cubic precision!


Example of radial minimization


Comparison of the two Hermite methods<br />

Radial cosine Method 1 Method 2

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!