How do you calculate the weighting of a point inside of an equilateral triangle compared to its vertices

geometrytriangles

In an equilateral triangle that contains a point, how do you calculate 3 weights that sum to 100% and indicate how much influence each vertex has on the point.

When the point is in the center all the weights are 33%:

Example 1

And if it's on one edge they should be split between the vertices that share that edge:

Example 2

This is similar to how an HSL color wheel works:

HSL Color wheel

Best Answer

I ended up using another method to solve this. In the diagram below to calculate the weight for a point, find the distance from the control point to the line opposite it and then divide by the triangle's height.

For the weight of A:

weightOfA = lengthOfx / triangleHeight

enter image description here