1
$\begingroup$

How can I compute the gradient for a tetrahedral mesh (3D)? For triangular mesh, I got an answer from the following post Calculating the gradient of a triangular mesh

How can I get a similar formula for 3D mesh?

Thanks in advance.

$\endgroup$
1
$\begingroup$

Assuming a value is assigned to each vertex of the mesh and we use purely linear interpolation, then there will be a constant gradient vector within each tetrahedron.

Linear interpolation can be expressed using barycentric coordinates, like $$ f(x,y,z) = f_1 w_1(x,y,z) + f_2 w_2(x,y,z) + f_3 w_3(x,y,z) + f_4 w_4(x,y,z) $$ where $f_1 \ldots f_4$ are the values of the function at the four vertices, and $w_1 \ldots w_4$ are the barycentric weights for each vertex. Then, finding the gradient of $f$ reduces to finding the gradients of all of the weights.

This can be worked out geometrically by noting that each $w_i$ is 1 at the $i$th vertex, falling off to 0 at the plane formed by the other three vertices. The gradient vector will therefore be normal to that plane, pointing back towards the $i$th vertex, with a magnitude equal to 1 / the distance from the plane to the vertex.

Once you've calculated those barycentric gradients, you can multiply them by $f_1 \ldots f_4$ and sum them up to arrive at the gradient of $f$ overall.

This reasoning works for triangles too, by the way, only replace "plane" with "line".

$\endgroup$
  • $\begingroup$ Is there a similar way to compute the Laplacian operator for 3D mesh? $\endgroup$ – Bis Aug 31 '20 at 1:16
  • $\begingroup$ Laplacians are tricky to even define, because it's a second-derivative operator, so with linear interpolation it would just be zero. Getting a useful answer out of it requires defining some higher-order interpolation scheme first. You can see some approaches to this in Laplace–Beltrami: The Swiss Army Knife of Geometry Processing $\endgroup$ – Nathan Reed Aug 31 '20 at 2:33
  • $\begingroup$ Thank you. I will take a look at it. $\endgroup$ – Bis Aug 31 '20 at 5:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.