<p>It's defining the gradient in terms of barycentric coordinates. It is similar to the derivation in <a href="https://computergraphics.stackexchange.com/a/10169/48">this answer</a>, only rearranged a bit algebraically using the fact that the three barycentric coordinates sum to one.
<span class="math-container">$$
\begin{aligned}
f(\mathbf{u}) &amp;= f_i B_i(\mathbf{u}) + f_j B_j(\mathbf{u}) + f_k B_k(\mathbf{u}) \\
&amp;= f_i (1 - B_j(\mathbf{u}) - B_k(\mathbf{u})) + f_j B_j(\mathbf{u}) + f_k B_k(\mathbf{u}) \\
&amp;= f_i + (f_j - f_i) B_j(\mathbf{u}) + (f_k - f_i) B_k(\mathbf{u}) \\
\nabla f(\mathbf{u}) &amp;= (f_j - f_i) \nabla B_j(\mathbf{u}) + (f_k - f_i) \nabla B_k(\mathbf{u}) \\
\end{aligned}
$$</span></p>

CC BY-SA 4.0
2020-09-22T18:06:16.813Z
2020-09-22T18:26:25.573Z
2020-09-22T18:26:25.573Z
Nathan Reed
<p>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.</p>
<p>The highlighted formula is the intermediate state of transforming the function  fully utilizes vertices.</p>

CC BY-SA 4.0
2020-08-22T14:42:08.020Z
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
Makogan
CC BY-SA 4.0
2020-08-23T00:04:24.883Z
https://www.mathsisfun.com/algebra/trig-area-triangle-without-right-angle.html
xer-rex
CC BY-SA 4.0
2020-08-22T07:42:44.697Z
2020-08-22T07:42:44.697Z
xer-rex
<p>I am trying to understand how to get the discrete gradient of a mesh that is being used as the input of some function <span class="math-container">$f$</span>. In other words for every vertex <span class="math-container">$v$</span> there is a scalar quantity <span class="math-container">$s$</span> associated with it.</p>
<p>I am trying to understand how to compute the discrete gradient of <span class="math-container">$f$</span> on the surface. For that purpose I was checking these slides:</p>
<p><a href="http://www.hao-li.com/cs599-ss2015/slides/Lecture04.1.pdf" rel="nofollow noreferrer">http://www.hao-li.com/cs599-ss2015/slides/Lecture04.1.pdf</a></p>
<p>But it's not clicking. The piece wise notation I am assuming is just an attempt at formalizing &quot;we have no idea what the values at the triangles would be, so we are just going to linearly interpolate using Barycentric coordinates&quot;.</p>
<p>But then the slides reach this final formula for the gradient:
<a href="https://i.sstatic.net/Mx9hP.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/Mx9hP.png" alt="enter image description here" /></a></p>
<p>I kinda understand the bottom part, which seems to say the gradient basis at <span class="math-container">$i$</span> 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?</p>

<mathematics><computational-geometry><geometry>
Discrete Gradient?
Makogan
# Discrete Gradient?

(Asked by: username_0 on 2020-08-21)

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:

<http://www.hao-li.com/cs599-ss2015/slides/Lecture04.1.pdf>

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](https://i.sstatic.net/Mx9hP.png)](https://i.sstatic.net/Mx9hP.png)

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?

**Tags:** mathematics, computational-geometry, geometry


---

## 2 answers

### Answer by username_1 on 2020-09-22. Score: 2 | Accepted answer

It's defining the gradient in terms of barycentric coordinates. It is similar to the derivation in [this answer](https://computergraphics.stackexchange.com/a/10169/48), 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}
$$


---

### Answer by username_2 on 2020-08-22. Score: 0

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.

> **Comments:**
> **username_0**: 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  
> **username_2**: https://www.mathsisfun.com/algebra/trig-area-triangle-without-right-angle.html  

---

