In an affine space , there’s the concept of affine combination, which states that any point in space can be represented as an affine combination in the form
We can add an additional restriction on the values of $\lambda_i$ to define a triangle built from three points. If $\lambda_1 = \beta, \lambda_2 = \gamma$, $\beta + \gamma = 1$, and $\beta, \gamma [0,1]$, then a triangle is defined as the affine combination
barycentric coordinates
One geometric property of the scalar values is that they’re the signed scaled distance from the lines that pass through the triangle sides. To compute the scalar values $\beta$ and $\gamma$, we can use the fact that when the implicit equation of the line that passes through a side is evaluated with points that don’t lie on the line, the result is equal to
beta
Where $d_{(x,y)}$ is the distance from the point $(x,y)$ to the line. $A$ and $B$ are the coefficients of $x$ and $y$ in the general equation of the line that passes through $a$ and $c$.
To find the value of $\beta$, we can use the value of the implicit equation of the line to map the distance between any point to the line in the range $[f_{ac}(x_a, y_a), f_{ac}(x_b, y_b)] = [0, f_{ac}(x_b, y_b)]$. We can then use a simple division to find the value of $\beta$.
In a similar fashion the value of $\gamma$ is