 # Jacobians and Hessians of Mean Value Coordinates for Closed Triangular Meshes

In this technical note, we present the formulae of the derivatives of the Mean Value Coordinates based transformations, using an enclosing triangle mesh, acting as a cage for the deformation of an interior object.

## Authors

##### This week in AI

Get the week's most popular data science and artificial intelligence research sent straight to your inbox every Saturday.

## I Background

### I-a Mean Value Coordinates for Closed Triangular Meshes

Mean Value Coordinates for closed triangular meshes were introduced in . In this section, we briefly review this work and describe the notations we will use in the rest of this note.

As written in , a 3D point can be expressed as a linear sum of the 3D positions of the vertices of a triangular mesh by: .

For a point onto the surface (a two-dimensional parameter), we note as usual the linear function on that takes value 1 on vertex and 0 on other vertices, and its 3D position. The definition of the weights should guarantee linear precision (i.e. ).

Since (the integral of the unit outward normal onto the unit sphere is ), we have

 η=∫Bη(M)p[x]|p[x]−η|dSη(x)∫Bη(M)1|p[x]−η|dSη(x) (1)

being the projection of the manifold onto the unit sphere centered in .

Writing that , with , we obtain

 η=∑i∫Bη(M)ϕi[x]|p[x]−η|dSη(x)pi∫Bη(M)1|p[x]−η|dSη(x) (2)

The weights are given by

 λi=∫Bη(M)ϕi[x]|p[x]−η|dSη(x)∫Bη(M)1|p[x]−η|dSη(x) (3)

And the weights such that are given by

 wi=∫Bη(M)ϕi[x]|p[x]−η|dSη(x) (4)

This definition guarantees linear precision; it gives a linear interpolation of the function onto the triangles of the cage; and it extends it in a regular way to the entire 3D space.

##### Computing the weights wi

The support of the function is only composed of the adjacent triangles to the vertex . Then, we can rewrite Eq. 4 as , with

 wTi=∫Bη(T)ϕi[x]|p[x]−η|⋅d¯¯¯¯T (5)

Given a triangle with vertices , we see that

 ∑jwTtj⋅(ptj−η)=∫Bη(T)∑jϕtj[x]⋅(ptj−η)|p[x]−η|⋅d¯¯¯¯T=∫Bη(T)p[x]−η|p[x]−η|⋅d¯¯¯¯T≜mT (6)

This last integral is simply the integral of the unit outward normal on the spherical triangle .

By noting , with (see Fig.1), it can be easily expressed as

 mT=∑i12θTinTi (7)

This comes from the fact that the integral of the unit outward normal on a closed surface is always 0.

Finally, we obtain

 ∑jwTtj⋅(ptj−η)=mT (8)

This point was discussed in . As the authors pointed out, by noting the 3 by 3 matrix , we can derive the weights by

 {wTt1,wTt2,wTt3}t=AT−1⋅mT (9)

Since , we have from Eq. 8 that

 wTti=NTit⋅mTNTit⋅(pti−η)=NTit⋅mTdet(AT)  ∀η∉Support(T) (10)

## Ii MVC Derivatives

We now present the derivatives of the Mean Value Coordinates. Deforming the cage mesh with induces a deformation of the 3D space by . In the rest of the document, for any function , we note its derivative by and , its gradient, its jacobian, and its hessian.

The deformation function as defined acts now on entirely. The derivatives of can be expressed as a linear sum of positions :

 ⎧⎪ ⎪ ⎪ ⎪ ⎪⎨⎪ ⎪ ⎪ ⎪ ⎪⎩Jf=∑i¯¯¯¯pi⋅→▽λitH(fx)=∑i¯¯¯¯¯xi⋅HλiH(fy)=∑i¯¯¯¯yi⋅HλiH(fz)=∑i¯¯¯¯zi⋅Hλi (11)

Consequently, it allows to specify implicit equations on the cage in a linear system by giving specified rotations and scales on 3D locations, or to minimize the norm of the hessian to force rigidity, as done in the case of Green Coordinates in .

Since ,

 →▽λi=→▽wi∑jwj−wi⋅∑j→▽wj(∑jwj)2 (12)

We also have

 ∂c(→▽λi)=∂c(→▽wi)∑jwj−→▽wi⋅∑j∂c(wj)(∑jwj)2−∂c(wi)⋅∑j→▽wj+wi⋅∑j∂c(→▽wj)(∑jwj)2+2wi⋅(∑j→▽wj)⋅(∑k∂c(wk))(∑jwj)3 (13)

or

 Hλi=Hwi∑jwj−wi∑jHwj(∑jwj)2−→▽wi⋅∑j→▽(wj)t+∑j→▽(wj)⋅→▽wit(∑jwj)2+2wi(∑j→▽wj)⋅(∑j→▽wj)t(∑jwj)3 (14)

From these expressions, we see that, in order to get and , we first need to obtain and for each vertex of the cage.

### Special case: η lies on the surface of the cage

Mean Value Coordinates define an interpolation process. The function represented onto the vertices of the cage (in our case, a space transformation) is extended to the interior of the triangles with linear interpolation on each triangle. Then it is extended to the space by means of a surfacic integration of the function (see Eq. 1).

Since we represent the cage as triangle mesh in the 3D case, the deformation function cannot be anything more than continuous onto the edges of the cage in 3D. Therefore Jacobians and Hessians of the deformation cannot be evaluated everywhere on the surface of the cage, and we do not provide any formula for Jacobians and Hessians of the deformation onto the surface of the cage.

### Ii-a Expression of the Jacobians

In the general case where , we have

with

 BT=∑jeq1(θTj)NTj⋅NTjt⋅JNTj2(|ptj+2−η||ptj+1−η|)3−∑jNTj⋅(2η−ptj+1−ptj+2)t2(|ptj+2−η||ptj+1−η|)2+∑jeq2(θTj)JNTj2|ptj+2−η||ptj+1−η|+∑jwTtj⋅I3

and and two well defined functions on that admit well controlled Taylor expansion around , ,

being the skew 3 by 3 matrix (i.e.

) such that .

#### Special case: η∈Support(T),∉T

 −2|T|→▽wTi=∑jeq2(θTj)(pti+2−pti+1)t⋅(ptj+2−ptj+1)2|ptj+2−η||ptj+1−η|nT+∑jeq1(θTj)|ptj+2−ptj+1|2NTit⋅NTj4(|ptj+2−η||ptj+1−η|)3nT+∑jcos(θTj)eq3(θTj)NTit⋅NTj2(|ptj+2−η||ptj+1−η|)2nT (15)

with and being functions well defined on and that admit controlable Taylor expansion around .

### Ii-B Expression of the Hessians

We note .

 (16)

with

 ∂c(JmT)=∑jeq6(θTj)(JNTjt⋅NTj)(c)NTj⋅NTjt⋅JNTj2(|ptj+2−η||ptj+1−η|)5−∑jeq7(θTj)(2η−ptj+1−ptj+2)(c)NTj⋅NTjt⋅JNTj2(|ptj+2−η||ptj+1−η|)4+∑jeq1(θTj)∂c(NTj)⋅NTjt⋅JNTj2(|ptj+2−η||ptj+1−η|)3+∑jeq1(θTj)NTj⋅∂c(NTj)t⋅JNTj2(|ptj+2−η||ptj+1−η|)3−∑j3eq1(θTj)(η−ptj+1)(c)NTj⋅NTjt⋅JNTj2|ptj+2−η|3|ptj+1−η|5−∑j3eq1(θTj)(η−ptj+2)(c)NTj⋅NTjt⋅JNTj2|ptj+2−η|5|ptj+1−η|3−∑j∂c(NTj)⋅(2η−ptj+1−ptj+2)t2(|ptj+2−η||ptj+1−η|)2+∑j(η−ptj+1)(c)NTj⋅(2η−ptj+1−ptj+2)t|ptj+2−η|2|ptj+1−η|4+∑j(η−ptj+2)(c)NTj⋅(2η−ptj+1−ptj+2)t|ptj+2−η|4|ptj+1−η|2+∑jeq8(θTj)(JNTjt⋅NTj)(c)JNTj2(|ptj+2−η||ptj+1−η|)3−∑jeq9(θTj)(2η−ptj+1−ptj+2)(c)JNTj2(|ptj+2−η||ptj+1−η|)2−∑j(η−ptj+1)(c)eq2(θTj)JNTj2|ptj+2−η||ptj+1−η|3−∑j(η−ptj+2)(c)eq2(θTj)JNTj2|ptj+2−η|3|ptj+1−η|−∑jNTj⋅δct|ptj+2−η|2|ptj+1−η|2 (17)

and , and being functions well defined on and that admit controllable Taylor expansion around .

#### Special case: η∈Support(T),∉T

 H(wTi)(η)=→▽dwTi(η)⋅ntT (18)

with

 −2|T|→▽dwTi=−∑j((pti+2−pti+1)t⋅(ptj+2−ptj+1))(2η−ptj+2−ptj+1)(|ptj+2−η||ptj+1−η|)2+∑jeq1(θTj)((pti+2−pti+1)t⋅(ptj+2−ptj+1))JNTjt⋅NTj2(|ptj+2−η||ptj+1−η|)3+∑j|ptj+2−ptj+1|2(NTit⋅NTj)(2η−ptj+2−ptj+1)2(|ptj+2−η||ptj+1−η|)4+∑jeq1(θTj)|ptj+2−ptj+1|2(JNTjt⋅NTi+JNTit⋅NTj)4(|ptj+2−η||ptj+1−η|)3−∑jeq4(θTj)|ptj+2−ptj+1|2(NTit⋅NTj)JNTjt⋅NTj2(|ptj+2−η||ptj+1−η|)5+∑jcos(θTj)eq3(θTj)(JNTjt⋅NTi+JNTit⋅NTj)2(|ptj+2−η||ptj+1−η|)2−∑j(1−2cos(θTj))(NTit⋅NTj)(2η−ptj+2−ptj+1)2(|ptj+2−η||ptj+1−η|)3+∑jeq5(θTj)(NTit⋅NTj)JNTjt⋅NTj2(|ptj+2−η||ptj+1−η|)4 (19)

and and being functions well defined on and that admit controllable Taylor expansion formula around .

## References

•  M. Ben-Chen, O. Weber, and C. Gotsman, Variational harmonic maps for space deformation, ACM Transactions on Graphics (Proc. of ACM SIGGRAPH) (2009), 1–11.
•  T. Ju, S. Schaefer, and J. Warren, Mean value coordinates for closed triangular meshes, ACM Transactions on Graphics (Proc. of ACM SIGGRAPH) 24 (2005), no. 3, 561–566.