function tri_coef,X,Y ;+ ;c=tri_coef(X,Y) returns an interpolation vector of length ;three that describes a linear interpolation at a known point ;[X[3],Y[3]] when the values [Z[0],Z[1],Z[2]] are given at ;points (X[0],Y[0]), (X[1],Y[1]), (X[2],Y[2]). ; ;Vectors X and Y must contain four components, namely, the ;coordinates of the corners of a triangle and the coordinates ;of another point, presumably within the triangle. ; ;The notion is that this program will be used to compute ;coefficients to a known grid from a set of known DeLaunay ;triangles. This enables us to pre-compute the triangles ;and insert the Z values at the end. ; ;H. Rhody ;October 5, 2004 ;- d = (x[1] - x[2])*y[0] + (x[2] - x[0])*y[1] + (x[0] - x[1])*y[2]; c0 = (x[2]*y[1] - x[1]*y[2] + x[3]*(y[2] - y[1]) - y[3]*(x[2] - x[1]))/d; c1 = (x[0]*y[2] - x[2]*y[0] + x[3]*(y[0] - y[2]) - y[3]*(x[0] - x[2]))/d; c2 = (x[1]*y[0] - x[0]*y[1] + x[3]*(y[1] - y[0]) - y[3]*(x[1] - x[0]))/d; Return,[c0,c1,c2] end