Barycentric coordinates of a triangle are very useful for interpolating texture coordinates, for example. Each corner contains the texture coordinate and multiplies this coordinate by the barycentric coordinate. (very simple). Also very useful is that the addition of all 3 components of the barycentric coordinate is always `1`. The barycentric coordinate is therefore well suited for the interpolation of information based on corner points. But can it also be used to interpolate triangle edge based data instead of vertex based data?

**The problem:**

I have a triangular mesh that needs to be tessellated in different ways depending on a variable called `biome`. Within the tessellation control shader, each edge generates a `biome` number depending on the position and normals of the vertices. The normals are stored per vertex and not per face, so that neighboring faces receive the same normal for common vertices. The neighboring edge of two neighboring triangles will therefore generate the same `biome` number. 
This is very important as otherwise holes will appear during the evaluation shader.
These `biome` numbers are stored in the following way:

A varying `vec3` patch variable contains the 3 `biom` numbers. The number generated by vertex0 and vertex1 is stored under index [2]. The number generated by vertex1 and vertex2 is stored under index [0]. And vertex0 and vertex2 is stored in index [1]. In comparison to `gl_TessCoord`, the biome number of the edge is therefore stored in the opposite corner.
The tessellation evaluation shader receives the barycentric coordinates via the `gl_TessCoord` vector. So this is the point where I want to start.

Now I am looking for an algorithm that performs the interpolation between the edges.

An image shows more than 1000 words...

[![enter image description here][1]][1]

Within this triangle, the edges should retain their biome numbers (no interpolation at the edges), and the area in between should be an interpolation of the numbers.

So, as with barycentric coordinates, the sum of the weights should be around 1.

I know that the vertices are not defined within the interpolation. That will be handled later... so don't think about it.



  [1]: https://i.sstatic.net/pp9ko.png