linear interpola on from cells
play

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)


  1. Linear Interpola-on from Cells Han-Wei Shen The Ohio State University

  2. 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) Polyvertex (c) line (a) vertex (e) Quadrilateral (e) Polygon (f) Tetrahedron (f) Hexahedron

  3. Why Interpola-on? • Example: Produce a color map from a 2D regular grid 13 10 P = ? p 9 12 1. Interpolate the values from the cell corners to get the value of P 2. Apply a color to P

  4. Linear Interpola-on (LERP) • Linear interpola-on (lerp): connec-ng two points with a straight line in the func-on plot f(x) true value f(x2) lerp(f(x1),f(x2) f(x1) x P x1 x2

  5. Linear Interpola-on (LERP) • General form: V p = Σ w i * v i (weighted sum) v 1 v 2 P v i : value at vertex i • wi: weight for v i v 4 v 3

  6. Linear Interpola-on (LERP) • General form: V p = Σ w i * v i (weighted sum) v 1 v 2 P v i : value at vertex i • wi: weight for v i v 4 v 3 • 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

  7. LERP in Line V p ? P v 1 v 2 b a • Parametric coordinate of P: α = a / (a+b) • Linearly interpolated value of P: V p = (1- α ) * V 1 + α * V 2 lerp(v1,v2, α )

  8. Lerp in Triangle A V p ? P C B

  9. Lerp in Triangle A V p ? P δ A C B

  10. Lerp in Triangle A V p ? δ B P δ A C B

  11. Lerp in Triangle A V p ? δ B δ C P δ A C B

  12. Lerp in Triangle A V p ? δ B δ C P δ A C B • Parametric coordinates of P: ( α , β , γ ) α = δ A / ( δ A + δ B + δ C ) Baricentric Coordinates β = δ B / ( δ A + δ B + δ C ) γ = δ C / ( δ A + δ B + δ C ) • Linearly interpolated value of P: V A * α + V B * β + V C * γ

  13. Lerp in Rectangle B A V p ? P D C

  14. Lerp in Rectangle a B A V p ? P D C a • Parametric coordinates of P: ( α , β ) α = a / width;

  15. Lerp in Rectangle L 1 a B A V p ? P D C a L 2 • Parametric coordinates of P: ( α , β ) α = a / width; • Value at L 1 = Lerp(V A ,V B , α ) ; • Value at L 2 = Lerp(V C ,V D , α ) ;

  16. Lerp in Rectangle L 1 a B A V p ? P b D C a L 2 • Parametric coordinates of P: ( α , β ) α = a / width;

  17. Lerp in Rectangle L 1 a B A V p ? P b D C a L 2 • Parametric coordinates of P: ( α , β ) α = a / width; β = b / height

  18. Lerp in Rectangle L 1 a B A V p ? P b D C a L 2 • Parametric coordinates of P: ( α , β ) α = a / width; β = b / height • Linearly interpolated value of P: Lerp(V L1 , V L2 , β )

  19. Lerp in Rectangle L 1 a B A V p ? P b D C a L 2 • Parametric coordinates of P: ( α , β ) Bi-linear interpola-on α = a / width; β = b / height Bi-Lerp(V A ,V B , V C ,V D ) • Linearly interpolated value of P: Lerp(V L1 , V L2 , β )

  20. Lerp in Cube V 6 V 7 V 4 V 5 P z V 2 V 3 y x V 0 V 1

  21. Lerp in Cube V 6 V 7 B V 4 V 5 P z V 2 V 3 y A x V 0 V 1 Value at A = Bi-Lerp(V 0 ,V 1 ,V 2 ,V 3 ) ; • Value at B = Bi-Lerp(V 4 ,V 5 ,V 6 ,V 7 ) ; •

  22. Lerp in Cube V 6 V 7 B V 4 V 5 P z V 2 V 3 y A x V 0 V 1 Value at A = Bi-Lerp(V 0 ,V 1 ,V 2 ,V 3 ) ; • Value at B = Bi-Lerp(V 4 ,V 5 ,V 6 ,V 7 ) ; •

  23. Lerp in Cube V 6 V 7 B V 4 V 5 P z V 2 V 3 y A x V 0 V 1 Value at A = Bi-Lerp(V 0 ,V 1 ,V 2 ,V 3 ) ; • Value at B = Bi-Lerp(V 4 ,V 5 ,V 6 ,V 7 ) ; • Tri-linear Value at P = Lerp(A,B, PA/AB); • interpola-on

  24. Lerp in Cube V 6 V 7 V 4 V 5 P c z V 2 V 3 y b x a V 0 V 1 Another way to perform calculate the value at P: Parametric coordinates of P: ( α , β ) • α = a / width; β = b / depth (along y); γ = c / height Value at P = • (1- α )(1- β )(1- γ )V 0 + α (1- β )(1- γ )V 1 + (1- α ) β (1- γ )V 2 + αβ (1- γ )V 3 + (1- α )(1- β ) γ V 4 + α (1- β ) γ V 5 + (1- α ) βγ V 6 + α b ρ V 7

  25. Lerp in Cube V 6 V 7 V 4 V 5 P c z V 2 V 3 y b x a V 0 V 1 Another way to perform calculate the value at P: Parametric coordinates of P: ( α , β , γ ) • α = a / width; β = b / depth (along y); γ = c / height Value at P = • (1- α )(1- β )(1- γ )V 0 + α (1- β )(1- γ )V 1 + (1- α ) β (1- γ )V 2 + αβ (1- γ )V 3 + (1- α )(1- β ) γ V 4 + α (1- β ) γ V 5 + (1- α ) βγ V 6 + αβγ V 7

  26. Lerp in Tetrahedron D P A C B

  27. Lerp in Tetrahedron D P A C B • 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

  28. Lerp in Tetrahedron D P A C B • Tetrahedral coordinates of P: ( α , β , γ , δ ) α = V BDCP / V ABCD β = V ACDP / V ABCD γ = V ADBP / V ABCD δ = V ABCP / V ABCD • Linearly interpolated value of P: V A * α + V B * β + V C * γ + V D * δ

  29. Volume of Tetrahedron 4 (x 4 ,y 4 ,z 4 ) 1 (x 1 ,y 1 ,z 1 ) 3 (x 3 ,y 3 ,z 3 ) 2 (x 2 ,y 2 ,z 2 ) V = 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

Recommend


More recommend