Position Value in a Triangle

118 Views Asked by At

I have a triangle. Each of the 3 corners is assigned a different value. Lets say corner 1 is 100, corner 2 is 200, and corner 3 is 300. I want to pick a coordinate in the middle of the triangle and find its relative value. So if it were in the very middle, it would have a value of 200 (100+200+300 / 3). How would I find its value if it is not in the very middle? For example, if it was a distance of 10 from corner 1, and a distance of 80 from corner 2, and a distance of 100 from corner 3, I would want corner's value to have a lot of influence, and corner's 2 and 3 to have less influence.

Sorry for the poor wording. Math is not really my thing. Let me know if I can help clarify.

1

There are 1 best solutions below

0
On BEST ANSWER

We can think of the triangle as the convex hull on three points $p_1, p_2, p_3$. $$T = \{ x \in \mathbb{R}^2 \mid x = a_1 p_1 + a_2 p_2 + a_3 p_3, a_1 + a_2 + a_3 = 1, a_i \geq 0\}$$ If we call the function assigning a value to every point $S$ we can in this notation express it as $S(x) = a_1 S(p_1) + a_2 S(p_2) + a_3 S(p_3)$.

Edit: I googled and apparently this is called "barycentric interpolation"