What I have is an arbitrary triangle and its bounding box in 2D. Each of the triangle's vertices may carry the usual attributes like UV coordinates, color, etc. Problem is, I need to find the interpolated values of any present attributes within the triangle at arbitrary points (eg from fragment screen space coordinates). Another problem is I'm not keeping any data associated with the triangle other than the actual vertices and its bounding box.
Ergo I figured the fastest solution would probably be to calculate the interpolated values at the corners of the bounding box, from where it's a simple matter of bilerping the two sides to get the value at any location. For UV-s this is easy, but color and normals are turning out to be a bit of a headache.
Or it could be that it's 5 AM and I'm just braindead.
The attached image contains two out of three possible generic cases (the last one is that all of the triangle's vertices match the bounding box's corners).
To recap the problem: I know color (or any other arbitrary) values at v0, v1 and v2 and I need to find them at p0, p1, p2 and p3. I can only assume to have access to normalized and absolute bounding box coordinates and triangle vertices.