2 ***********************************************************
3 $SNARK_Header: S N A R K 1 4 - A PICTURE RECONSTRUCTION PROGRAM $
4 $HeadURL: svn://dig.cs.gc.cuny.edu/snark/trunk/src/snark/foru_vint14.cpp $
5 $LastChangedRevision: 85 $
6 $Date: 2014-07-02 16:07:08 -0400 (Wed, 02 Jul 2014) $
8 ***********************************************************
10 ------------------------------------------------------------------
12 PURPOSE: GIVEN THE COORDINATES OF A POINT (XG,YG) AND ITS FOUR
13 NEIGHBORS (XX(I),YY(I)) CALCULATE THE INTERPOLATED VALUE
16 ------------------------------------------------------------------
28 #define dis(xa,ya,xb,yb) ((REAL) sqrt(((xa)-(xb))*((xa)-(xb))+((ya)-(yb))*((ya)-(yb))))
30 void foru_class::vint14(
39 REAL* gr, // changed to pass address. Lajos, Feb 10, 2005
40 REAL* gi // changed to pass address. Lajos, Feb 10, 2005
43 REAL d1 = dis(xx[1], yy[1], xg, yg);
44 REAL d2 = dis(xx[2], yy[2], xg, yg);
45 REAL d3 = dis(xx[3], yy[3], xg, yg);
46 REAL d4 = dis(xx[4], yy[4], xg, yg);
48 // changed to dereference "gr" and "gi" in order to return computed values. Lajos, Feb 10, 2005
49 if (Fourie.interp != 4)
54 //REAL d = amin1(d1,d2,d3,d4);
55 REAL d = MIN0(MIN0(d1, d2), MIN0(d3, d4));
60 *gi = pj2[indmax + 1];
65 *gi = pj2[indmin + 1];
70 *gi = pj1[indmax + 1];
75 *gi = pj1[indmin + 1];
82 REAL e1 = d2 * d3 * d4;
83 REAL e2 = d1 * d3 * d4;
84 REAL e3 = d1 * d2 * d4;
85 REAL e4 = d1 * d2 * d3;
87 if (e1 <= Consts.zero)
89 if (e2 <= Consts.zero)
91 if (e3 <= Consts.zero)
93 if (e4 <= Consts.zero)
96 REAL e = e1 + e2 + e3 + e4;
98 *gr = (pj1[indmin] * e1 + pj1[indmax] * e2 + pj2[indmin] * e3
99 + pj2[indmax] * e4) / e;
101 *gi = (pj1[indmin + 1] * e1 + pj1[indmax + 1] * e2
102 + pj2[indmin + 1] * e3 + pj2[indmax + 1] * e4) / e;