I am trying to understand how to get the discrete gradient of a mesh that is being used as the input of some function $f$. In other words for every vertex $v$ there is a scalar quantity $s$ associated with it.

I am trying to understand how to compute the discrete gradient of $f$ on the surface. For that purpose I was checking these slides:


But it's not clicking. The piece wise notation I am assuming is just an attempt at formalizing "we have no idea what the values at the triangles would be, so we are just going to linearly interpolate using Barycentric coordinates".

But then the slides reach this final formula for the gradient: enter image description here

I kinda understand the bottom part, which seems to say the gradient basis at $i$ is a vector orthogonal to the opposite edge divided by 2 times the area of the triangle (I assume), but how was the top formula derived?


2 Answers 2


It's defining the gradient in terms of barycentric coordinates. It is similar to the derivation in this answer, only rearranged a bit algebraically using the fact that the three barycentric coordinates sum to one. $$ \begin{aligned} f(\mathbf{u}) &= f_i B_i(\mathbf{u}) + f_j B_j(\mathbf{u}) + f_k B_k(\mathbf{u}) \\ &= f_i (1 - B_j(\mathbf{u}) - B_k(\mathbf{u})) + f_j B_j(\mathbf{u}) + f_k B_k(\mathbf{u}) \\ &= f_i + (f_j - f_i) B_j(\mathbf{u}) + (f_k - f_i) B_k(\mathbf{u}) \\ \nabla f(\mathbf{u}) &= (f_j - f_i) \nabla B_j(\mathbf{u}) + (f_k - f_i) \nabla B_k(\mathbf{u}) \\ \end{aligned} $$


An area consists of 2 components, the normalized gradient of the basis_i gives the constant rate in the direction of one of the components which only depends on vertices.

The highlighted formula is the intermediate state of transforming the function fully utilizes vertices.

  • $\begingroup$ Pardon my reading comprehension skills but you say it has 2 components but I only read one component in your answer, what's the other? : p $\endgroup$
    – Makogan
    Aug 22, 2020 at 14:42
  • $\begingroup$ mathsisfun.com/algebra/… $\endgroup$
    – xer-rex
    Aug 23, 2020 at 0:04

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.