Let’s suppose there is an underformed triangle ABC in 2D. There is a point P inside this triangle. Then triangle ‘ABC’ is being deformed somehow, including deformation of it’s inner points. How can I find new coords of point ‘P’?
I think that there should be a way of representing point ‘P’ as:
P = k1*A + k2*B + k3*C, where k1, k2, k3 are some coefficients. Then we can just use this formula for deformed triangle. But I don’t understand how to find these coefficients in general case.
PS: As I understand opengl textures work this way.
Think of a triangle as two vectors that share a common origin – v1 is the vector from A to B, v2 is the vector from A to C. We don’t need to worry about the implied vector from B to C.
All the interior space of the triangle can be mapped by taking linear combinations of v1 and v2, where the coefficients scale from 0 to 1. So if the coefficients are (0,0), I have the original vertex A again. Note that the full set of possibilities here actually maps out the quadrilateral – (1,1) would be a point outside your given triangle.
Nonetheless, for a given interior point, you can map it into the space formed by v1,v2 and get a coefficient pair. If we draw a line from A to the interior point, that’s some vector P; the coefficient for v1 would just be the dot product of P and v1; likewise for v2.
Then for the deformed triangle, the deformed interior space is the same coefficients projected against the new v1, v2 formed by the new vertices.