Download - Geometric Modeling
![Page 1: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/1.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Geometric ModelingCotangent Laplacian Derivation
Acknowledgements: Olga Diamanti, Julian Panetta
![Page 2: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/2.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Cotan Laplacian Motivation
Normal ComputationMean Curvature
RANDOM EQUATIONS FOR SLIDES 3
Y =
2
66664
�f(v1)�f(v2)�f(v3)
· · ·�f(vN )
3
77775
L =
2
6664
w11 w12 · · · w1N
w21 w22 · · · w2N...
... · · ·...
wN1 wN2 · · · wNN
3
7775= {wij}
wij =
8<
:
0 i 6= j, @ edge (i, j)1 i 6= j, 9 edge (i, j)�|N(vi)| i = j
wij =
8>><
>>:
0 i 6= j, @ edge (i, j)cot↵j+cot�j
2A(vi)i 6= j, 9 edge (i, j)
�P
vk2N(vi)wik i = j
F =
2
66664
f(v1)f(v2)f(v3)· · ·
f(vN )
3
77775
(I � �dtL)vn+1 = vn
vn+1 = v
n + �dtLvn+1
vn+1 � v
n = �dtLvn
vn+1 = (I + �dtL)vn
@v
@t= �L(v)
@f
@t= ���f
n = �[Lv]i2Hi
Hi =1
2
���� [Lv]i
����
Smoothing
• Discrete Laplacian enables many useful operations on triangle meshes:
• Cotangent weights give less mesh-dependent results, ensuring proper convergence under mesh refinement
…
![Page 3: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/3.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Where We’re Headed
• “Cotan Laplacian” refers to weight on each edge contribution.
• We’ll consider two different ways to derive this formula:
• “Traditional graphics approach:” Finite Volume-style
• Finite Element Approach (more general)
�cotanM f(v) =
1
2A(v)
X
vi2N(v)
(cot(↵i) + cot(�i))
✓f(vi)� f(v)
◆
Discrete Laplace-Beltrami
k Second Approach: Cotangent Formula
CGL slideset 10
1
2(cot(↵i) + cot(�i))
![Page 4: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/4.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Goal: Mesh Independence• We want discrete Laplacian to
converge to the Laplace Beltrami operator of smooth surface Sas mesh M is refined to better approximate S.
• F is a vector of discrete values (per vertex), f(x) is a smooth function.
• Idea: reinterpret F as a function interpolating the smooth “f,” and directly compute its Laplacian. Converge as F —> f
RANDOM EQUATIONS FOR SLIDES 3
Y =
2
66664
�f(v1)�f(v2)�f(v3)
· · ·�f(vN )
3
77775
L =
2
6664
w11 w12 · · · w1N
w21 w22 · · · w2N...
... · · ·...
wN1 wN2 · · · wNN
3
7775= {wij}
wij =
8<
:
�|N(vi)| i = j
0 i 6= j, @ edge (i, j)1 i 6= j, 9 edge (i, j)
F =
2
66664
f(v1)f(v2)f(v3)· · ·
f(vN )
3
77775
@f
@t= ���f
�cotanM F �! �Sf
![Page 5: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/5.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Piecewise-Linear Interpolation• Since F holds per-vertex values, it naturally corresponds to a
linear function on each triangle
• (Corner values uniquely determine linear function over triangle)
xy
f(x, y)
![Page 6: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/6.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
“Hat Function” Basis• Piecewise linear functions are expressed most simply using the
“hat functions” (linear Lagrange polynomials)
• One basis function per vertex,
• Unique linear function (on triangles) having:
• Interpolation of F on mesh M is just:
�i(vj) =
(1 if i = j
0 otherwise
�i(x) vi
fM (x) =X
i
f(vi)�i(x)
![Page 7: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/7.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Gradients• Recall, the Laplacian is the divergence of the gradient:
• So we first need to compute our interpolant’s gradient:
• In other words, the gradient is just a linear combination of the basis function gradients weighted by the per-vertex f values.
rfM (x) = r X
i
f(vi)�i(x)
!=X
i
f(vi)r�i(x)
r�i(x)
�f = r · (rf)
![Page 8: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/8.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Hat Function Gradients• Basis functions are linear over each triangle, so these gradients are
constant on each triangle
• We can determine gradient with simple geometric arguments:�0(v0) = 1
�0(v1) = 0 �0(v2) = 0
Where does the gradient point? What about its magnitude?
![Page 9: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/9.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Gradient Derivation�0(v0) = 1
�0(v1) = 0 �0(v2) = 0e0
e?0
r�0 · e0 = 0 =) r�0 = ↵e0?
h=) r�0 =
1
h
e?0��e?0��
r�0 · h
e?0��e?0��
!= 1
=) r�0 =e?02A
(area is 1/2 * base * height)
![Page 10: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/10.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Final Gradient Expression
• Note, this is the gradient evaluated on one triangle T incident vertex i. (Different gradient on others).
• Works on curved triangle meshes too! Just need triangle area and inward-pointing perpendicular edge vectors:
• Full gradient is then the linear combination
rfM (x) =X
i
f(vi)r�i(x)
r�i|T =e?i2AT
e?i = n⇥ ei
![Page 11: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/11.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Now the Laplacian!• Now we want to compute
• But the gradient is piecewise constant! What does divergence even mean?
�fM = r ·rfM (x) = r · X
i
f(vi)r�i(x)
!
![Page 12: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/12.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Too Many Derivatives!• Problem: function is piecewise linear (only C0 continuous) and we’re
trying to take second derivatives
• But we can make sense of things by using the Divergence Theorem over some region “R”:
• (This allows us to avoid explicitly computing divergence; just need dot products with the curve normals on R’s boundary.)
n
nn
n
n
n
R@R
Z
Rr · (r�) dx =
Z
@Rn ·r� ds
![Page 13: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/13.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Approach 1: (Traditional in Graphics)• Idea: define Laplacian on a vertex to be the
average over some region surrounding the vertex.
• To get cotan Laplacian, you need to average overthe vertices’ Voronoi regions (region for which v is the closest vtx).
• This region seems somewhat arbitrary; approach 2 won’t need this choice.
R(vi)vi
@R(vi)
[LF]i :=1
|R(vi)|
Z
R(vi)r ·rfM (x) dx
=1
|R(vi)|
Z
@R(vi)n ·rfM (x) ds
![Page 14: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/14.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Approach 1 Continued• Break into sum over triangles (so gradient is constant):
n1
n2
vi
`1`2
[LF]i =1
|R(vi)|
Z
@R(vi)n ·rfM (x) ds
=1
|R(vi)|X
T3vi
Z
T\@R(vi)
n ·rfM (x) ds
=1
|R(vi)|X
T3vi
rfT ·Z
T\@R(vi)
n ds
=1
|R(vi)|X
T3vi
rfT · (n1`1 + n2`2)
![Page 15: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/15.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Voronoi Diagram Properties
• Voronoi diagram edges bisect vi’s incident edges
n1
n2
vi
`1`2
n1
n2
vi
vj
vkn3
vi + vj
2
vi + vk
2 n1`1 + n2`2 + n3`3 = 0
(Tri edge vectors sum to zero; so do their perpendiculars.)
ei
[LF]i =1
|R(vi)|X
T3vi
rfT · (n1`1 + n2`2)
=) [LF]i =1
|R(vi)|X
T3vi
rfT · e?i
2
=) n1`1 + n2`2 = �n3`3 =
✓vk + vi
2� vj + vi
2
◆?
=1
2(vk � vj)
? =e?i2
![Page 16: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/16.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Plug in per-Tri Gradient
e?i + e?j + e?k = 0edges sum to zero:( )
vi
vj
vk
ei
ej
ek
[LF]i =1
|R(vi)|X
T3vi
rfT · e?i
2
=1
|R(vi)|X
T3vi
(fir�i + fjr�j + fkr�k) ·e?i2
=1
|R(vi)|X
T3vi
"fi
e?i2AT
+ fje?j2AT
+ fke?k2AT
#· e
?i
2
=1
|R(vi)|X
T3vi
"�fi
e?j2AT
+e?k2AT
!+ fj
e?j2AT
+ fke?k2AT
#· e
?i
2
=1
|R(vi)|X
T3vi
"(fj � fi)
e?j2AT
+ (fk � fi)e?k2AT
#· e
?i
2
![Page 17: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/17.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Final Steps
e?i · e?k4AT
=keikkekk cos(�)2keikkekk sin(�)
=1
2cot(�)
e?i · e?j4AT
=keikkejk cos(↵)2keikkejk sin(↵)
=1
2cot(↵)
Note:
vi
vj
vk
ei
ej
ek
↵
�
[LF]i =1
|R(vi)|X
T3vi
"(fj � fi)
e?j2AT
+ (fk � fi)e?k2AT
#· e
?i
2
=1
|R(vi)|X
T3vi
(fj � fi)e?j · e?i4AT
+ (fk � fi)e?k · e?i4AT
[LF]i =1
|R(vi)|X
T3vi
(fj � fi) cot(↵) + (fk � fi) cot(�)
![Page 18: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/18.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
• We have the cotan weights now, but expressed as a sum over triangles:
• To get the standard formula, we can regroup these terms as a sum over edges:
• |R(vi)| is the area of the ith vertex’s Voronoi region (the averaging area)
Regrouping Terms
[LF]i =1
2|R(vi)|X
T3vi
(fj � fi) cot↵+ (fk � fi) cot�
[LF]i =1
2|R(vi)|X
vj2N(vi)
(cot(↵ij) + cot(�ij))
✓f(vj)� f(vi)
◆
![Page 19: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/19.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Approach 2: Finite Element Method• Instead of trying to discretize the Laplacian itself (using averaging
regions), we discretize the whole PDE containing it. For instance:
• Here “b” is a forcing term (e.g. injecting/sinking heat at each point), and we assume M is a closed surface mesh without a boundary.
• If M had boundary curves, we’d need to specify boundary conditions.
��u = b in M
![Page 20: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/20.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Weak Form of the Poisson Equation• We can’t expect a piecewise linear function “u” to solve this PDE exactly
(why does its Laplacian mean, anyway?)
• But we can ask it to be a “weak solution:”
• In other words, we ask for zero residual “along” all test functions.
• Linear FEM: choose piecewise linear functions for both and
• Physical interpretation: minimizing a potential energy over the space of piecewise linear functions
�Z
M �u dx =
Z
M b dx 8 “test functions”
u
![Page 21: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/21.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Expand Functions in Basis�Z
M �u dx =
Z
M b dx
u(x) :=X
j
uj�j(x) (x) :=X
i
ai�i(x) b(x) :=X
j
bj�j(x)
�Z
M
X
i
ai�i(x)
!�
0
@X
j
uj�j(x)
1
A dx =
Z
M
X
i
ai�i(x)
!0
@X
j
bj�j(x)
1
A dx
=) �X
i,j
aiuj
✓Z
M�i��j dx
◆=X
i,j
aibj
✓Z
M�i�j dx
◆
![Page 22: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/22.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Integration by Parts for• To avoid second derivatives, apply divergence theorem in the form
of an integration by parts (move derivative onto )
• Note the “product rule”: r · (�ir�j) = �i��j +r�i ·r�j =)�i��j = r · (�ir�j)�r�i ·r�j
�Z
M�i��j dx = �
Z
Mr · (�ir�j)�r�i ·r�j dx
= �Z
@Mn · (�ir�j) ds+
Z
Mr�i ·r�j dx
=
Z
Mr�i ·r�j dx
Apply divergence theorem
There is no boundary!
Z
M�i��j dx
�i
![Page 23: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/23.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Laplacian and Mass Matrices• Now our weak PDE looks like:
• Expressed in matrix form:
• Plugging in gradient expressions:
X
i,j
aiuj
✓Z
Mr�ir�j dx
◆=
X
i,j
aibj
✓Z
M�i�j dx
◆
aTLu = aTMb 8a
Lij =
Z
Mr�i ·r�j dx =
X
T3vi,vj
e?T,i
2AT·e?T,j
2ATAT =
X
T3vi,vj
e?T,i · e?T,j
4AT
Lij Mij
=) Lu = Mb
Weak form must hold for all test functions!
![Page 24: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/24.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
Laplacian Matrix Cotangent Weights
Lij =X
T3vi,vj
e?T,i · e?T,j
4AT
Lij =
8>>>><
>>>>:
1
2(cot(↵ij) + cot(�ij)) if i 6= j
X
T3vi
e?T,i ·⇣�e?T,j � e?T,k
⌘
4AT= �1
2
X
vk2N(vi)
(cot(↵ik) + cot(�ik)) if i = j
vi
vj↵ij
�ij
![Page 25: Geometric Modeling](https://reader030.vdocuments.us/reader030/viewer/2022012415/616f834f5886202f871e5210/html5/thumbnails/25.jpg)
CSCI-GA.3033-018 - Geometric Modeling - Daniele Panozzo
FEM vs “Graphics Approach”• Get exactly the same cotan weights (up to division by region area)
• FEM doesn’t require defining an averaging region
• FEM computes Laplacian integrated against test function instead of an averaged (point) quantity:
• FEM uses exact mass matrix to integrate RHS against test functions; graphics approach uses diagonal “Lumped” approximation Mdiag based on region areas (e.g. Voronoi)—still converges, but higher error.(Lumping effectively treats the RHS function “b” as piecewise constant over the averaging region, while FEM+exact mass matrix treats it as piecewise linear).
• FEM generalizes to higher degree; just use more basis functions!
LFEM = MdiagLAvg Mdiag = diag([R(v0), R(v1), · · · ])