3. Mesh Parameterization - Overview
tex
ma ture
pp
ing
R3
re-
M
s am
1
pli
parameterization
ng
zoom
D R2 2
4. Overview
• Dirichlet Energy on Meshes
• Harmonic Parameterization
• Spectral Flattening
• Barycentric Coordinates for Warping
• Geodesic Flattening
• High Dimensional Data Analysis 3
5. Local Averaging
>0 if j Vi ,
Local operator: W = (wij )i,j V where wij =
0 otherwise.
(W f )i = wij fj .
(i,j) E
Examples: for i j,
wij = 1 wij = 1
||xj xi ||2 wij = cot( ij ) + cot(⇥ij )
combinatorial distance conformal
(explanations later)
˜ wij
Local averaging operator W = (wij )i,j
˜ V : ⇥ (i, j) E, wij =
˜ .
(i,j) E wij
˜
W =D 1
W with D = diagi (di ) where di = wij .
(i,j)⇥E
˜
Averaging: W 1 = 1.
4
6. Voronoi and Dual Mesh
Definition for a planar triangulation M of a mesh M R2 .
Voronoi for vertices: ⇧ i ⇤ V, Ei = {x ⇤ M ⇧ j ⌅= i, ||x xi || ⇥ ||x xj ||}
Voronoi for edges: ⌅ e = (i, j) ⇥ E, Ee = {x ⇥ M ⌅ e ⇤= e, d(x, e) d(x, e )}
Partition of the mesh: M = Ei = Ee .
i V e E
Ai
i i
cf A(ij)
cf
j j
Dual mesh 1:3 subdivided mesh 5
7. Approximating Integrals on Meshes
Approximation of integrals on vertices and edges:
⇥
f (x)dx Ai f (xi ) Ae f ([xi , xj ]).
M i V e=(i,j) E
i
T heorem : ⇥ e = (i, j) E, A(ij)
cf
1
Ae = Area(Ee ) = ||xi xj ||2 (cot( ij ) + cot(⇥ij )) j
2
8. Approximating Integrals on Meshes
Approximation of integrals on vertices and edges:
⇥
f (x)dx Ai f (xi ) Ae f ([xi , xj ]).
M i V e=(i,j) E
i
T heorem : ⇥ e = (i, j) E, A(ij)
cf
1
Ae = Area(Ee ) = ||xi xj ||2 (cot( ij ) + cot(⇥ij )) j
2
A
Proof: + + =
2
||AB||
A(ABO) = ||AB|| h = ||AB|| tan( )
2 O
h
2
||AB|| ⇤
A(ABO) = tan ( + ⇥) C
2 2
B
10. Cotangent Weights ⇧ (i, j) ⇤ E, wij = 1.
Distance weights: they depends both on the geometry and the to
require faces information,
Sobolev norm (Dirichlet energy): J(f ) = 2 1
|| f (x)|| dx
⇧ (i, j) ⇤ E, wij =
||xj xi ||2
.
M
Conformal weights: they depends on the full geometrical realiza
require the face information
Approximation of Dirichelet energy: ⇧ (i, j) ⇤ E, wij = cot( ij ) + cot(⇥
⇥
|f (xj ) f (xi )|2
Figure 1.2 shows the geometrical meaning of the angles ij and
||⇤x f || dx ⇥
2
Ae |(Gf )e | = 2
Ae
ij = ⇥(xi , xj , xk1 )
||xj xand ⇥ij = ⇥(xi
2
M i ||
e E (i,j) E
where (i, j, k1 ) ⇤ F and (i, j, k2 ) ⇤ F are the two faces adjacent
= wij |fnext ) f (xiexplanation of these celebrated cotangent
in the
(xj section the )|2
(i,j) E
where wij = cot( ij ) + cot(⇥ij ).
xi
ij
xk1
ij
xk2
xj 7
11. Cotangent Weights ⇧ (i, j) ⇤ E, wij = 1.
Distance weights: they depends both on the geometry and the to
require faces information,
Sobolev norm (Dirichlet energy): J(f ) = 2 1
|| f (x)|| dx
⇧ (i, j) ⇤ E, wij =
||xj xi ||2
.
M
Conformal weights: they depends on the full geometrical realiza
require the face information
Approximation of Dirichelet energy: ⇧ (i, j) ⇤ E, wij = cot( ij ) + cot(⇥
⇥
|f (xj ) f (xi )|2
Figure 1.2 shows the geometrical meaning of the angles ij and
||⇤x f || dx ⇥
2
Ae |(Gf )e | = 2
Ae
ij = ⇥(xi , xj , xk1 )
||xj xand ⇥ij = ⇥(xi
2
M i ||
e E (i,j) E
where (i, j, k1 ) ⇤ F and (i, j, k2 ) ⇤ F are the two faces adjacent
= wij |fnext ) f (xiexplanation of these celebrated cotangent
in the
(xj section the )|2
(i,j) E
where wij = cot( ij ) + cot(⇥ij ).
xi
xk1
T heorem : wij > 0 ⇥ ij + ⇥ij < ⇤ ij
ij
xk2
xj 7
12. Overview
• Dirichlet Energy on Meshes
• Harmonic Parameterization
• Spectral Flattening
• Barycentric Coordinates for Warping
• Geodesic Flattening
• High Dimensional Data Analysis 8
13. Mesh Parameterization
Parameterization: bijection : M ⇤ D ⇥ R2 .
Hypothesis: =( 1, 2) is smooth, minimizes
min0 wi,j (| 1 (i) 1 (j)|
2
+| 2 (i) 2 (j)| )
2
(i,j) E
With boundary conditions 0
: ⇥ xi ⇥M, (i) = 0
(i) ⇥D.
3D space (x,y,z)
2D parameter domain (u,v)
boundary
boundary 9
14. Mesh Parameterization
Parameterization: bijection : M ⇤ D ⇥ R2 .
Hypothesis: =( 1, 2) is smooth, minimizes
min0 wi,j (| 1 (i) 1 (j)|
2
+| 2 (i) 2 (j)| )
2
(i,j) E
With boundary conditions 0
: ⇥ xi ⇥M, (i) = 0
(i) ⇥D.
⇥ i / ⇥M, (L 1 )(i) = (L 2 )(i)
=0
Optimality conditions: ⇥ i ⇥M, (i) = 0 (i) ⇥D.
⇥ sparse linear system to solve. 3D space (x,y,z)
2D parameter domain (u,v)
boundary
boundary 9
15. Mesh Parameterization
Parameterization: bijection : M ⇤ D ⇥ R2 .
Hypothesis: =( 1, 2) is smooth, minimizes
min0 wi,j (| 1 (i) 1 (j)|
2
+| 2 (i) 2 (j)| )
2
(i,j) E
With boundary conditions 0
: ⇥ xi ⇥M, (i) = 0
(i) ⇥D.
⇥ i / ⇥M, (L 1 )(i) = (L 2 )(i)
=0
Optimality conditions: ⇥ i ⇥M, (i) = 0 (i) ⇥D.
⇥ sparse linear system to solve. 3D space (x,y,z)
2D parameter domain (u,v)
Remark: each point is the
average of its neighbors:
⇥ i / ⇥M, (i) = wi,j (j).
˜
(i,j) E
Theorem: (Tutte) if i, j, wij > 0,
then is a bijection.
boundary
boundary 9
21. Mesh Parameterization #1
: S0 ⇥ S ⇥x S0 ⇥S0 , =0
S0 ⇥ S S
Discretization of :
W = make_sparse(n,n);
for i=1:3
i1 = mod(i-1,3)+1; i2 = mod(i ,3)+1; i3 = mod(i+1,3)+1;
pp = vertex(:,faces(i2,:)) - vertex(:,faces(i1,:));
qq = vertex(:,faces(i3,:)) - vertex(:,faces(i1,:));
% normalize the vectors
pp = pp ./ repmat( sqrt(sum(pp.^2,1)), [3 1] );
qq = qq ./ repmat( sqrt(sum(qq.^2,1)), [3 1] );
% compute angles
a = 1 ./ tan( acos(sum(pp.*qq,1)) );
a = max(a, 1e-2); % avoid degeneracy
W = W + make_sparse(faces(i2,:),faces(i3,:), a, n, n );
W = W + make_sparse(faces(i3,:),faces(i2,:), a, n, n );
end
S0
14
22. Mesh Parameterization #1
: S0 ⇥ S ⇥x S0 ⇥S0 , =0
S0 ⇥ S S
Discretization of :
W = make_sparse(n,n);
for i=1:3
i1 = mod(i-1,3)+1; i2 = mod(i ,3)+1; i3 = mod(i+1,3)+1;
pp = vertex(:,faces(i2,:)) - vertex(:,faces(i1,:));
qq = vertex(:,faces(i3,:)) - vertex(:,faces(i1,:));
% normalize the vectors
pp = pp ./ repmat( sqrt(sum(pp.^2,1)), [3 1] );
qq = qq ./ repmat( sqrt(sum(qq.^2,1)), [3 1] );
% compute angles
a = 1 ./ tan( acos(sum(pp.*qq,1)) );
a = max(a, 1e-2); % avoid degeneracy
W = W + make_sparse(faces(i2,:),faces(i3,:), a, n, n );
W = W + make_sparse(faces(i3,:),faces(i2,:), a, n, n );
end
S0
Formation of the linear system:
D = spdiags(full( sum(W,1) ), 0, n,n);
L = D - W; L1 = L; L1(boundary,:) = 0;
L1(boundary + (boundary-1)*n) = 1;
14
23. Mesh Parameterization #1
: S0 ⇥ S ⇥x S0 ⇥S0 , =0
S0 ⇥ S S
Discretization of :
W = make_sparse(n,n);
for i=1:3
i1 = mod(i-1,3)+1; i2 = mod(i ,3)+1; i3 = mod(i+1,3)+1;
pp = vertex(:,faces(i2,:)) - vertex(:,faces(i1,:));
qq = vertex(:,faces(i3,:)) - vertex(:,faces(i1,:));
% normalize the vectors
pp = pp ./ repmat( sqrt(sum(pp.^2,1)), [3 1] );
qq = qq ./ repmat( sqrt(sum(qq.^2,1)), [3 1] );
% compute angles
a = 1 ./ tan( acos(sum(pp.*qq,1)) );
a = max(a, 1e-2); % avoid degeneracy
W = W + make_sparse(faces(i2,:),faces(i3,:), a, n, n );
W = W + make_sparse(faces(i3,:),faces(i2,:), a, n, n );
end
S0
Formation of the linear system:
D = spdiags(full( sum(W,1) ), 0, n,n);
L = D - W; L1 = L; L1(boundary,:) = 0;
L1(boundary + (boundary-1)*n) = 1;
Formation of the RHS and resolution:
Rx = zeros(n,1); Rx(boundary) = x0;
Ry = zeros(n,1); Ry(boundary) = y0;
x = L1 Rx; y = L1 Ry;
14
24. Mesh Parameterization #2
Geometry image: re-sample X/Y/Z coordinates of on a grid.
store the surface as a color (R/G/B) image.
Exercise: perform the linear interpolation of the parameterization.
Exercise: display the geometry image using a checkboard texture.
15
25. Mesh Parameterization #3
Exercise: Locate the position of the eyes / the mouth
in the texture and on the mesh.
Exercise: Compute an a ne transformation to re-align the texture.
16
26. Mesh Deformations
Initial position: xi R3 .
Displacement of anchors:
i I, xi xi = xi + i R3
I xi
Linear deformation: xi
xi = xi + (i)
i I, (i) = i
i / I, (i) = 0
17
27. Mesh Deformations
Initial position: xi R3 . % modify Laplacian
L1 = L; L1(I,:) = 0;
Displacement of anchors: L1(I + (I-1)*n) = 1;
% displace vertices
vertex = vertex + ( L1 Delta0' )';
i I, xi xi = xi + i R 3
I xi
Linear deformation: xi
xi = xi + (i)
i I, (i) = i
i / I, (i) = 0
17
28. Mesh Deformations
Initial position: xi R3 . % modify Laplacian
L1 = L; L1(I,:) = 0;
Displacement of anchors: L1(I + (I-1)*n) = 1;
% displace vertices
vertex = vertex + ( L1 Delta0' )';
i I, xi xi = xi + i R 3
I xi
Linear deformation: xi
xi = xi + (i)
i I, (i) = i
i / I, (i) = 0
˜
ni xi
Non-linear deformation:
xi = xi + i
˜ ˜
xi
coarse details
scale
Linear deformation: xi
˜ ˜
xi
Extrusion along normals: xi = xi + i, ˜
n i ni
17
29. Overview
• Dirichlet Energy on Meshes
• Harmonic Parameterization
• Spectral Flattening
• Barycentric Coordinates for Warping
• Geodesic Flattening
• High Dimensional Data Analysis 18
31. Mesh Flattening
No boundary condition, minimize:
⇥ || 1 ||= 1,
minn ||G 1 || =
2
wi,j | 1 (i) 1 (j)|
2
with
1 ⇥R
i j
⇥ 1 , 1⇤ = 0.
⇧
⌅ ||
⇤ 2 ||= 1,
minn ||G 2 ||
2
= wi,j | 2 (i) 2 (j)|
2
with ⇥ 2 , 1 ⇤ = 0,
2 ⇥R ⌅
⇥
2 , 1⇤ = 0.
i j ⇥
Theorem: ⇥i = i+1 L⇥i ,
where 0 =0 1 2 ... n 1 are eigenvalues of L = G⇥ G.
( 1 (i), 2 (i)) R2
combinatorial conformal 19
32. Proof
Spectral decomposition: L=G G=D W =U U
= diag( i ) where 0 = 1 < 2 ... n
U = (ui )n orthonormal basis of Rn .
i=1 u1 = 1
20
33. Proof
Spectral decomposition: L=G G=D W =U U
= diag( i ) where 0 = 1 < 2 ... n
U = (ui )n orthonormal basis of Rn .
i=1 u1 = 1
n
E(⇥) = ||G⇥||2 = i | ⇥, ui ⇥|2
i=1 n
If , 1 = 0, then E(⇥) = i ai where ai = | ⇥, ui ⇥|2
i=2
20
34. Proof
Spectral decomposition: L=G G=D W =U U
= diag( i ) where 0 = 1 < 2 ... n
U = (ui )n orthonormal basis of Rn .
i=1 u1 = 1
n
E(⇥) = ||G⇥||2 = i | ⇥, ui ⇥|2
i=1 n
If , 1 = 0, then E(⇥) = i ai where ai = | ⇥, ui ⇥|2
i=2
n
Constrained minimization: Pnmin i ai
i=2 ai =1
i=2
linear program: minimum reached at a = i.
±u2 = argmin E( )
, 1⇥=0,|| || 20
38. Barycentric Coordinates
x
x1 1
x2
x x
x3
x2 x3
˜ i (x) = A(x, xi+1 , xi+2 )
A(x1 , x2 , x3 )
i (x)
Barycentric coordinates: { i (x)}i I Normalized: ˜ i (x) =
j j (x)
Positivity: i (x) 0.
˜
Interpolation: ⇥i (xj ) = i,j
Reproduction of a ne functions: ˜ i (x)xi = x
i I
23
39. Barycentric Coordinates
x
x1 1
x2
x x
x3
x2 x3
˜ i (x) = A(x, xi+1 , xi+2 )
A(x1 , x2 , x3 )
i (x)
Barycentric coordinates: { i (x)}i I Normalized: ˜ i (x) =
j j (x)
Positivity: i (x) 0.
˜
Interpolation: ⇥i (xj ) = i,j
Reproduction of a ne functions: ˜ i (x)xi = x
i I
Application: interpolation of data {fi }i f (x) = ˜ i (x)fi
I
i I
23
40. Barycentric Coordinates
x
x1 1
x2 xi
x x
x3
x2 x3 xj
˜ i (x) = A(x, xi+1 , xi+2 )
A(x1 , x2 , x3 )
i (x)
Barycentric coordinates: { i (x)}i I Normalized: ˜ i (x) =
j j (x)
Positivity: i (x) 0.
˜
Interpolation: ⇥i (xj ) = i,j
Reproduction of a ne functions: ˜ i (x)xi = x
i I
Application: interpolation of data {fi }i f (x) = ˜ i (x)fi
I
i I
Application: mesh parameterization: wi,j = i (xj )
23
41. Mean Value Coordinates
Conformal Laplacian weights:
⇥i (x) = cotan( i (x)) + cotan( ˜i (x)) xi+1
not necessarily positive.
xi i i
Mean-value coordinates: x
˜i
tan( i (x)/2) + tan(˜ i (x)/2) ˜i
⇥i (x) =
||x xi ||
valid coordinates. xi
extend to non-convex coordinates (oriented angles).
˜ 1 (x) ˜ 2 (x)
24
42. Barycentric Coordinates for Warping
Cage C: polygon with vertices {xi }i I .
Data points: {yj }j J C. Example: textured grid, 3D model, etc.
Initialization: data anchoring, compute
j J, i I, i,j = i (yj ).
Satisfies: yi = i,j xi
i I
Cage warping: xi xi
Data warping: yj yj = i,j xi
i I
xi y
xi yi i
25
43. Harmonic Coordinates
Mean value coordinates:
“non-physical” behavior,
passes “through” the cage.
Harmonic mapping:
⇥ x C, i (x) = 0.
Boundary conditions:
⇥x ⇥C, i (x) = i (x).
0
Mean value Harmonic
26
45. Overview
• Dirichlet Energy on Meshes
• Harmonic Parameterization
• Spectral Flattening
• Barycentric Coordinates for Warping
• Geodesic Flattening
• High Dimensional Data Analysis 28
46. Geodesic Distances 1
def.
Length of a curve (t) M: L( ) = W ( (t))|| (t)||dt.
0
Geodesic distance: dM (x, y) = min L( )
(0)=x, (1)=y
Geodesic curve : dM (x, y) = L( )
Euclidean Shape Isotropic W = 1 Surface 29
47. Computation of Geodesic Distances
Distance map to a point: Ux0 (x) = dM (x0 , x).
Ux0
Non-linear PDE: || Ux0 (x)|| = W (x)
(viscosity) Ux0 (x0 ) = 0, x0
Upwind finite di erences approximation.
Fast Marching: front propagation in O(N log(N )) operations.
30
48. Manifold Flattening
Input manifold M, dM geodesic distance on M.
˜
Input geodesic distance matrix: D = (dM (˜i , xj )2 )i,j , for xi
x ˜ ˜ M.
Flattening: find X = (xi )p ⇤ Rn
i=1
p
such that ||xi xj || ⇥ dM (˜i , xj ).
x ˜
˜
x1 x1
x1
˜
x1
x2
x2 ˜
x2
˜
x2
M R3
M R2
Surface parameterization Bending invariant
31
49. Stress Minimization
Geodesic stress: S(X) = |||xi xj || di,j |2 , di,j = dM (˜i , xj )
x ˜
i,j
1 ()
SMACOF algorithm: X ( +1)
= X B(X ( ) )
N di,j
where B(X)i,j =
||xi xj ||
Non-convex functional : X ( )
X local minimizer of S.
32
50. Projection on Distance Matrices
D(X)i,j = ||xi xj ||2
min |||xi xj ||2 d2 |2 = ||D(X)
i,j D||2 , Di,j = d2
X1=0 i,j
i,j
||xi xj ||2 = ||xi ||2 + ||xj ||2 2⇥xi , xj ⇤
=⇥ D(X) = d1T + 1d 2X T X where d = (||xi ||2 )i ⇤ Rn
33
51. Projection on Distance Matrices
D(X)i,j = ||xi xj ||2
min |||xi xj ||2 d2 |2 = ||D(X)
i,j D||2 , Di,j = d2
X1=0 i,j
i,j
||xi xj ||2 = ||xi ||2 + ||xj ||2 2⇥xi , xj ⇤
=⇥ D(X) = d1T + 1d 2X T X where d = (||xi ||2 )i ⇤ Rn
Centering matrix: J = Idn 11T /N
1 JX = X
For centered points: JD(X)J = X T X
2 J1 = 0
33
52. Projection on Distance Matrices
D(X)i,j = ||xi xj ||2
min |||xi xj ||2 d2 |2 = ||D(X)
i,j D||2 , Di,j = d2
X1=0 i,j
i,j
||xi xj ||2 = ||xi ||2 + ||xj ||2 2⇥xi , xj ⇤
=⇥ D(X) = d1T + 1d 2X T X where d = (||xi ||2 )i ⇤ Rn
Centering matrix: J = Idn 11T /N
1 JX = X
For centered points: JD(X)J = X T X
2 J1 = 0
Replace ||D(X) D|| by
min || J(D(X) D)J/2|| = ||X T X + JDJ/2||
X
Explicit solution: diagonalize 1
2 JDJ = U UT i i 1
= diag( 0 , . . . , k 1 ),
k
X = k Uk T
Uk = (u0 , . . . , uk 1 ) ,
33
53. Isomap vs. Laplacian
Flattening: f = (f1 , f2 ) R2 .
Laplacian: local smoothness: fi = argmin ||Gf || subj. to ||f || = 1.
⇥ (f1 , f2 ) eigenvectors (#2,#3) of L = GT G.
Isomap: global constraints: ||f (x) f (y)|| ⇥ dM (x, y).
⇥ (f1 , f2 ) eigenvectors (#1,#2) of J(dM (xi , xj )2 )ij J.
Bijective
Not bijective
Mesh Lapl. combin. Lapl. conformal Isomap 34
54. Bending Invariants of Surfaces
Bending invariants: [Elad, Kimmel, 2003].
Surface M, Isomap dimension reduction: x ⇥ M ⇤ IM (x) ⇥ R3 .
M
IM
[Elad, Kimmel, 2003]. 35
55. Bending Invariants of Surfaces
Bending invariants: [Elad, Kimmel, 2003].
Surface M, Isomap dimension reduction: x ⇥ M ⇤ IM (x) ⇥ R3 .
Geodesic isometry :M M : dM (x, y) = dM ( (x), (y)).
Theorem: up to rigid motion, IM is invariant to geodesic isometries:
IM (x) = v + U IM ( (x)) where U O(3) and v R3 .
M
IM
[Elad, Kimmel, 2003]. 35
56. Bending Invariants of Surfaces
Bending invariants: [Elad, Kimmel, 2003].
Surface M, Isomap dimension reduction: x ⇥ M ⇤ IM (x) ⇥ R3 .
Geodesic isometry :M M : dM (x, y) = dM ( (x), (y)).
Theorem: up to rigid motion, IM is invariant to geodesic isometries:
IM (x) = v + U IM ( (x)) where U O(3) and v R3 .
M
IM
[Elad, Kimmel, 2003]. [Bronstein et al., 2005]. 35