Barycentric Coordinates and Tensor...

45
Taku Komura Barycentric Coordinates and L-System

Transcript of Barycentric Coordinates and Tensor...

Page 1: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Barycentric Coordinates and L-System

Page 2: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Overview

1. Barycentric coordinates

Wachspress Coordinates

Mean Value Coordinates

Harmonic Coordinates

2. L-system

Page 3: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Topology for Interpolation

Remember we introduced topology such that we can do interpolation

Page 4: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Interpolation

Geometric interpolation – derive the global coordinates for a position in parametric cell space

Attribute interpolation – derive the attribute value for a position defined in parametric cell space

∑∑=

i i

i ii

w

pwv

∑∑=

i i

i ii

w

fwvf ][ˆ

∑ j j

i

w

ware called barycentric coordinates

Page 5: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Barycentric Coordinates

Page 6: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Example of Barycentric Coordinates

Simple 2D shapes

Simple 3D

W0 = 1-r-s

W1 = r

W2 = s

p0 p

1

p2

s

r

W0 = (1-r)(1-s)

W1 = r(1-s)

W2 = (1-r)s

W3 = rs

s

r

p3

p2

p0

p1

1 0 ,1 ≤≤=∑ ii WW

Page 7: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

What about interpolation for general polygons?

x

p0

p1

p2

p3

p4

p5

r

s

Any quick solutions?

Page 8: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Quick Solution Subdivision into triangles / tetrahedra

– And then use the barycentric coordinates explained in slide 6 within the triangle / tetrahedron.

Only C0 continuous at the boundary Non-smooth transitions at the boundary of triangles

x

p0

p1

p2

p3

p4

p5

r

s

Page 9: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Wachspress coordinates

Only works with convex polygons

A(a,b,c) is the signed area of triangle abc

http://www.lidberg.se/math/shapetransforms/wachspress.html

Page 10: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Mean Value Coordinates

A good and smooth barycentric coordinates that can smoothly interpolate the boundary values

Also works with concave polygons

There is also a 3D version

Page 11: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

What are the required features of barycentric coordinates?

Interpolates values at vertices

Linear on boundary

Smooth on interior

Not affected by points that you need to travel a lot to reach within the polygon

Page 12: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Let's compare

convex polygons[Wachspress 1975]

closed polygons[Floater 2003, Hormann 2004]

Page 13: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Previous Work

convex polygons[Wachspress 1975]

closed polygons[Floater 2003, Hormann 2004]

Page 14: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Previous Work

convex polygons[Wachspress 1975]

closed polygons[Floater 2003, Hormann 2004]

Page 15: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Previous Work

convex polygons[Wachspress 1975]

closed polygons[Floater 2003, Hormann 2004]

Page 16: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

What are the required features of barycentric coordinates?

Interpolates values at vertices

Linear on boundary

Smooth on interior

→ Mean Value Coordinates perform good

Not affected by points that you need to travel a lot to reach within the polygon

Page 17: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Application:Surface Deformation

∑∑=

i i

i ii

w

pwv

ipv

Page 18: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Application:Surface Deformation

∑∑=

i i

i ii

w

pwv

ipv

Page 19: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Application:Surface Deformation

∑∑=

i i

i ii

w

pwv

ˆˆ

ip̂

∑∑=

i i

i ii

w

pwv

ipv

Page 20: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Application:Surface Deformation

∑∑=

i i

i ii

w

pwv

vip

∑∑=

i i

i ii

w

pwv

ˆˆ

ip̂

Page 21: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

ApplicationsBoundary Value Problems

Page 22: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

ApplicationsSolid Textures

Extend texture to interior

Page 23: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

ApplicationsSurface Deformation

Control Mesh Surface Computing Weights Deformation

216 triangles 30,000 triangles 1.9 seconds 0.03 seconds

Page 24: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

ApplicationsSurface Deformation

Control Mesh Surface Computing Weights Deformation

98 triangles 96,966 triangles 3.3 seconds 0.09 seconds

Page 25: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

What are the required features of barycentric coordinates?

Interpolates values at vertices

Linear on boundary

Smooth on interior

Not affected by points that you need to travel a lot to reach within the polygon

Page 26: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Interpolation : problem polygon

ill-formed polygon

− poor interpolation results based on point distance due to narrow concavity

Problem: This vertex has too strong an influence in the red region

http://www.youtube.com/watch?v=egf4m6zVHUI

Shows the problem of mean value coordinates at 1:54

Page 27: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Harmonic CoordinatesThe problem with Mean Value Coordinates is that their

values are affected by the Euclidean distance but not the distance that needs to be traveled

Affected by geometrically close points

Harmonic Scalar Field

– The value depends on the distance traveled inside the polygon

Not affected by geometrically close but topologically far points

Page 28: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Harmonic Coordinates : Procedure

• Discretize the space (adding a 2D/3D grid)

• For each vertex i of the cage, set the potential value of vi to 1, and the rest to 0

• Compute the potential for all the grid points j (f^j_i) by solving a Laplace equation (as taught in Lecture 16)

• (f^j_1, f^j_2, ...., f^j_n) is the harmonic coordinates for each grid point j

• The global position of point j can be expressed in the form

P = f^j_1 v1 + f^j_2 v2 + … + f^j_n vn

Page 29: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Editing the shape by Harmonic Coordinates

• Edit the shape by moving the control points (points of the cage)

• The new location of each vertex is computed by

where (v1’,v2’,...,vn’) are the new positions of the control points

P’ = f^j_1 v1’ + f^j_2 v2’ + … + f^j_n vn’

Page 30: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Harmonic Coordinates: comparison

Before editing Edited by MVC Edited by HC

Page 31: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Barycentric Coordinates Summary

Triangulation / Tetrahedralization

Only C0 continuous at the boundaries

Wachspress coordinates

Can only handle convex objects

Mean value coordinates

Can handle concave objects well to some extent

Values affected by geometrically close points

Defined outside the polygon too

Harmonic Coordinates

Can handle concave objects well

Only defined inside the polygon

Page 32: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Overview

1. Barycentric coordinates

Wachspress Coordinates

Mean Value Coordinates

Harmonic Coordinates

2. L-system

Page 33: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

What is an L-System ?

Lindenmayer system, or L-System, was introduced in 1968 by the biologist Aristid LindemmayerA mathematical theory on plant development. The central concept of L-systems is that of rewriting. It is a technique for defining complex objects by successively replacing parts of a simple initial object using a set of rewriting rules or production.

Page 34: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

L-Systems

Expanding the strings based on the deterministic rulesThe rewriting process starts from an initial string called the axiom. At each derivation step, all letters in the current string are replaced simultaneously by applying their associated productions.

Page 35: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

ExampleVariables a, bAxiom : aRULES: a->aba, b->bbb

How does it go on then?Step #0 : a (axiom)Step #1 : abaStep #2 : aba bbb aba Step #3 : aba bbb aba bbb bbb bbb aba bbb aba Step #4 : ...Because there is exactly one rewriting rule for each letter, the resulted strings will be deterministic . Because each letter was replaced regardless what neighbors it has, the rewriting rules are context-free

Page 36: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Turtle interpretation of L-strings

A turtle is sitting on a sheet of paper facing in a certain direction,

The tail of the turtle is a bit dirty. Thus, it leaves a trail along the paper.

By interpreting a L-string, the turtle leaves the trail along the paper

Page 37: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Turtle interpretation of L-strings

In 2D, for example, the state of the turtle is defined by its position and its heading vectorGiven the step size d and the angle increment δ, the turtle's movements can respond to the commands represented by the L-symbols : F Move forward a step of length d and connect the new position with the last position by a line segment. + Turn left by angle (counter clockwise) - Turn right by angle (clockwise). δ

δ

Page 38: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Bracketed L-systems

In order to specify the data structure for presenting axial trees, the concept of ``strings with brackets'' was introduced

The L-system's alphabet is extended by two new commands

[ Push the current state of the turtle onto a stack.

] Pop a state from the stack and make it the current state of the turtle.

Page 39: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

LParser

Axiom: FFFF[C]>>>>>>>>>[C]>>>>>>>>>[C]>>>>>>>>>[C]Rules: C=F!F[c---C]C> : rotation (10 degrees) around the forward axis-: rotation (10 degrees) around the horizontal axis! : decrement thickness with 0.7 c : increment in color index

Page 40: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

LParser(Example)

Axiom: FFFF[C]>>>>>>>>>[C]>>>>>>>>>[C]>>>>>>>>>[C] Rules: C=F!F[c---C]C

> : rotation around the forward axis

- : rotation around the horizontal axis

! : decrement thickness with 0.7

Page 41: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

LParser

Rules: C=F!F[c---C]C

> : rotation around the forward axis-: rotation around the horizontal axis

! : decrement thickness with 0.7

Page 42: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

LParser : Make it look better by adding more rotations

: C=F!^+F^+;'[c---C]

^ : rotation around the vertical axis

Page 43: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Stochastic L-systems

To avoid the artificial regularity of models generated by deterministic L-system, variation of turtle interpretation and/or randomization of L-productions are needed.For example, the productions :

p1 : a -> (0.7) b a

p2 : a -> (0.3) c aare 2 rewriting rules for the letter a. In one derivation step, either p1 or p2 will be applied to each occurrence of a, according to the given distribution (0.7 and 0.3).

Page 44: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Other exampleshttp://vimeo.com/7192863

Page 45: Barycentric Coordinates and Tensor Visualisationhomepages.inf.ed.ac.uk/tkomura/cav/presentation17.pdf · Taku Komura Harmonic Coordinates : Procedure • Discretize the space (adding

Taku Komura

Summary

Barycentric coordinates

Wachstress coordinates

Mean value coordinates

Harmonic Coordinates

L-system

ReferencesHarmonic Coordinates for Character Articulation, SIGGRAPH 2007

Mean Value Coordinates for Closed Triangular Meshes, SIGGRAPH 2005

Barycentric and Wachspress coordinates in two dimensions: theory and implementation for shape transformations, Petter Lidberg