I always forget this fact, so hopefully typing this out will help.

Let be a triangle with vertices , then there exists unique linear functions such that . This is the so called barycentric coordinates.

The fact here is that where is the length of the edge opposite vertex , and is the area of the triangle. The vector is the unit outward normal.

The derivation is simple. The direction of the gradient is towards the highest growth, and as the barycentric coordinates are linear functions, it’s clear that is the correct direction. The scaling is to simply note the area as where is the shortest distance from the edge to the vertex. This gives us the inverse of the slop as the barycentric coordinate has a value of 1 at the vertex.

when you say “unit normal” which unit normal are you referring to?

It’s probably best with an example. If the triangle has vertices (0, 0), (1, 0), (0, 1), then the unit outward normal for the edge (0, 0) — (1, 0) is (0, -1) (e.g. the vector which points directly south).

For the edge (0, 0) — (0, 1), it is (-1, 0).

For the edge (1, 0) — (0, 1), it is (1/sqrt(2), 1/sqrt(2)) (the square roots are there to normalize the vector).