-------------------------------------------------------------------------------------------------------- Additional details: If you wish to interpolate rays from a triple of images you can use barycentric coordinates. Barycentric coordinates are a way of representing a 2D point inside a triangle in terms of the surrounding three vertices (barycentric coordinates are actually more general and apply to N-dimensional spaces, but for this assignment, let’s just worry about N=2). Given the three vertices of the triangle (p1,p2,p3) and a point q, here’s a function to compute the barycentric coordinates (u,v,w) of the point q: /************************************************************************* Given three points and a point q, compute the barycentric coordinates of the point q. **************************************************************************/ static void ComputeBarycentricCoords(float q[2], float p1[2], float p2[2], float p3[2], float *u, float *v, float *w) { // 3x3 determinant of the denominator float d = p1[0]*p2[1] - p2[0]*p1[1] - p1[0]*p3[1] + p3[0]*p1[1] + p2[0]*p3[1] - p3[0]*p2[1]; // each numerator divided by common denominator *u = ( q[0]*p2[1] - p2[0]* q[1] - q[0]*p3[1] + p3[0]* q[1] + p2[0]*p3[1] - p3[0]*p2[1]) / d; *v = (p1[0]* q[1] - q[0]*p1[1] - p1[0]*p3[1] + p3[0]*p1[1] + q[0]*p3[1] - p3[0]* q[1]) / d; *w = (p1[0]*p2[1] - p2[0]*p1[1] - p1[0]* q[1] + q[0]*p1[1] + p2[0]* q[1] - q[0]*p2[1]) / d; }