Say that I have a quad, and I am applying a pool table texture to it. I know the UV coordinates for the first three vertices (highlighted in blue) but not the fourth.
For example in the image above, I know that the top left coordinates are [0, 0], the top right coordinates are [1, 0] and the bottom left are [0, 1]. How can I mathematically determine the bottom right UV coordinates are [1, 1]? I want to figure out what the fourth set of UV coordinates will be mathematically, such that the texture displayed in the triangle I do know the UV coordinates of will fit in the quad.
I need to be able to handle complex situations. The UV coordinates and X, Y and Z coordinates could be anything, except I do know that it will always be a flat face.
Finally, I need to be able to calculate this for faces with any number of vertices.
My initial approach to this involved checking how much the U coordinate changes over a certain X distance, and then the same for Y and Z until I found a relationship, but I keep finding new exceptions to that logic and I'm wondering if there's a simpler way.
How can I interpolate the UVs to calculate the fourth, fifth... nth point? In no particular coding language - I'm just looking for the approach.