Linear Interpola-on from Cells Han-Wei Shen The Ohio State - - PowerPoint PPT Presentation

linear interpola on from cells
SMART_READER_LITE
LIVE PREVIEW

Linear Interpola-on from Cells Han-Wei Shen The Ohio State - - PowerPoint PPT Presentation

Linear Interpola-on from Cells Han-Wei Shen The Ohio State University Why Interpola-on? Most visualiza-on algorithms have to deal with discrete data Data aEributes that define at the cell ver-ces (d) polyline (e) triangle (b)


slide-1
SLIDE 1

Linear Interpola-on from Cells

Han-Wei Shen The Ohio State University

slide-2
SLIDE 2

Why Interpola-on?

  • Most visualiza-on algorithms have to deal

with discrete data

– Data aEributes that define at the cell ver-ces

(a) vertex (b) Polyvertex (c) line (d) polyline (e) triangle (e) Quadrilateral (e) Polygon (f) Tetrahedron (f) Hexahedron

slide-3
SLIDE 3

Why Interpola-on?

p P = ? 10 13 9 12

  • Example: Produce a color map from a 2D

regular grid

  • 1. Interpolate the values from the cell corners to get

the value of P

  • 2. Apply a color to P
slide-4
SLIDE 4

Linear Interpola-on (LERP)

  • Linear interpola-on (lerp): connec-ng two

points with a straight line in the func-on plot

x f(x)

x1 f(x1) x2 f(x2) P lerp(f(x1),f(x2) true value

slide-5
SLIDE 5

Linear Interpola-on (LERP)

  • General form:

v1 v2 v3 v4

  • P

vi : value at vertex i

wi: weight for vi

Vp = Σ wi * vi (weighted sum)

slide-6
SLIDE 6

Linear Interpola-on (LERP)

  • General form:
  • Essen-al informa-on needed:

– Cell type – Data at cell corners – Parametric coordinates of the point in ques-on (P)

  • Related to the posi-on of point P in the cell

Vp = Σ wi * vi (weighted sum)

v1 v2 v3 v4

  • P

vi : value at vertex i

wi: weight for vi

slide-7
SLIDE 7

LERP in Line

  • Parametric coordinate of P: α = a / (a+b)

a b

v1 v2 P

  • Linearly interpolated value of P:

Vp ? lerp(v1,v2, α )

Vp = (1- α ) * V1 + α * V2

slide-8
SLIDE 8

Lerp in Triangle

A B C P Vp ?

slide-9
SLIDE 9

Lerp in Triangle

A B C P Vp ?

δA

slide-10
SLIDE 10

Lerp in Triangle

A B C P Vp ?

δA δB

slide-11
SLIDE 11

Lerp in Triangle

A B C P Vp ?

δA δB δC

slide-12
SLIDE 12

Lerp in Triangle

A B C P Vp ?

δA δB δC

  • Parametric coordinates of P: (α,β,γ)

α = δA / (δA + δB + δC) β = δB / (δA + δB + δC) γ = δC / (δA + δB + δC)

Baricentric Coordinates

  • Linearly interpolated value of P: VA * α + VB * β + VC * γ
slide-13
SLIDE 13

Lerp in Rectangle

A B C D Vp ? P

slide-14
SLIDE 14

Lerp in Rectangle

A B C D Vp ? P

  • Parametric coordinates of P: (α,β)

α = a / width;

a a

slide-15
SLIDE 15

Lerp in Rectangle

A B C D Vp ? P L1 L2

  • Value at L1 = Lerp(VA,VB,α) ;
  • Value at L2 = Lerp(VC,VD,α) ;
  • Parametric coordinates of P: (α,β)

α = a / width;

a a

slide-16
SLIDE 16

Lerp in Rectangle

A B C D Vp ? P L1 L2

b a

  • Parametric coordinates of P: (α,β)

α = a / width;

a

slide-17
SLIDE 17

Lerp in Rectangle

A B C D Vp ? P L1 L2

b a

  • Parametric coordinates of P: (α,β)

α = a / width; β = b / height

a

slide-18
SLIDE 18

Lerp in Rectangle

A B C D Vp ? P L1 L2

  • Linearly interpolated value of P: Lerp(VL1, VL2, β)

b a

  • Parametric coordinates of P: (α,β)

α = a / width; β = b / height

a

slide-19
SLIDE 19

Lerp in Rectangle

A B C D Vp ? P L1 L2

  • Linearly interpolated value of P: Lerp(VL1, VL2, β)

b a

  • Parametric coordinates of P: (α,β)

α = a / width; β = b / height

a

Bi-linear interpola-on Bi-Lerp(VA,VB, VC,VD)

slide-20
SLIDE 20

Lerp in Cube

x y z V2 V6 V4 V0 V5 V1 V3 V7

P

slide-21
SLIDE 21

Lerp in Cube

x y z V2 V6 V4 V0 V5 V1 V3 V7 B A

  • Value at A = Bi-Lerp(V0,V1,V2,V3) ;
  • Value at B = Bi-Lerp(V4,V5,V6,V7) ;

P

slide-22
SLIDE 22

Lerp in Cube

x y z V2 V6 V4 V0 V5 V1 V3 V7 B A

  • Value at A = Bi-Lerp(V0,V1,V2,V3) ;
  • Value at B = Bi-Lerp(V4,V5,V6,V7) ;

P

slide-23
SLIDE 23

Lerp in Cube

x y z V2 V6 V4 V0 V5 V1 V3 V7 B A

  • Value at A = Bi-Lerp(V0,V1,V2,V3) ;
  • Value at B = Bi-Lerp(V4,V5,V6,V7) ;
  • Value at P = Lerp(A,B, PA/AB);

P Tri-linear interpola-on

slide-24
SLIDE 24

Lerp in Cube

x y z c a b V2 V6 V4 V0 V5 V1 V3 V7

P

  • Parametric coordinates of P: (α,β)

α = a / width; β = b / depth (along y); γ = c / height

  • Value at P =

(1-α)(1-β)(1-γ)V0 + α(1-β)(1-γ)V1 + (1-α)β(1-γ)V2 + αβ(1-γ)V3 + (1-α)(1-β)γV4 + α(1-β)γV5 + (1-α)βγV6 + αbρV7

Another way to perform calculate the value at P:

slide-25
SLIDE 25

Lerp in Cube

x y z c a b V2 V6 V4 V0 V5 V1 V3 V7

P

  • Parametric coordinates of P: (α,β,γ)

α = a / width; β = b / depth (along y); γ = c / height

  • Value at P =

(1-α)(1-β)(1-γ)V0 + α(1-β)(1-γ)V1 + (1-α)β(1-γ)V2 + αβ(1-γ)V3 + (1-α)(1-β)γV4 + α(1-β)γV5 + (1-α)βγV6 + αβγV7

Another way to perform calculate the value at P:

slide-26
SLIDE 26

Lerp in Tetrahedron

P A B C D

slide-27
SLIDE 27

Lerp in Tetrahedron

P

  • Break the tetrahedron ABCD into four sub tetrahedra:

ABCP, BDCP, ACDP, ADBP

  • Calculate the volume of each small tetrahedra
  • Calculate P’s parametric (tetrahedral) coordinates

based on the ra-os of the volumes

A B C D

slide-28
SLIDE 28

Lerp in Tetrahedron

P A B C D

  • Tetrahedral coordinates of P: (α,β,γ,δ)

α = VBDCP / VABCD β = VACDP / VABCD γ = VADBP / VABCD δ = VABCP / VABCD

  • Linearly interpolated value of P: VA * α + VB * β + VC * γ + VD * δ
slide-29
SLIDE 29

V will be posi-ve if when you look at the triangle 123 from vertex 4, vertex 1 2 3 are In a counter clockwise order

Volume of Tetrahedron

1 (x1,y1,z1) 2 (x2,y2,z2) 3 (x3,y3,z3) 4 (x4,y4,z4)

V =