2 WARNING - Do not remove this header.
4 This code is a templated version of the 'magic-software' spherical
5 interpolation code by Dave Eberly. The original (un-hacked) code can be
6 obtained from here: http://www.magic-software.com/gr_appr.htm
7 This code is derived from linintp2.h/cpp and sphrintp.h/cpp.
9 Dave Eberly says that the conditions for use are:
11 * You may distribute the original source code to others at no charge.
13 * You may modify the original source code and distribute it to others at
14 no charge. The modified code must be documented to indicate that it is
15 not part of the original package.
17 * You may use this code for non-commercial purposes. You may also
18 incorporate this code into commercial packages. However, you may not
19 sell any of your source code which contains my original and/or modified
20 source code. In such a case, you need to factor out my code and freely
23 * The original code comes with absolutely no warranty and no guarantee is
24 made that the code is bug-free.
26 This does not seem incompatible with GPL - so this modified version
27 is hereby placed under GPL along with the rest of FlightGear.
37 unsigned int index[3];
44 mgcLinInterp2D (int _numPoints, double* x, double* y, unsigned int* _f);
48 double XMin () { return xmin; }
49 double XMax () { return xmax; }
50 double XRange () { return xmax-xmin; }
51 double YMin () { return ymin; }
52 double YMax () { return ymax; }
53 double YRange () { return ymax-ymin; }
55 int PointCount () { return numPoints; }
56 void GetPoint (int i, double& x, double& y);
58 int EdgeCount () { return numEdges; }
59 void GetEdge (int i, double& x0, double& y0, double& x1, double& y1);
61 int TriangleCount () { return numTriangles; }
62 void GetTriangle (int i, double& x0, double& y0, double& x1, double& y1,
63 double& x2, double& y2);
65 int Evaluate (double x, double y, EvaluateData& F);
76 int vertex[3]; // listed in counterclockwise order
79 // adj[0] points to triangle sharing edge (vertex[0],vertex[1])
80 // adj[1] points to triangle sharing edge (vertex[1],vertex[2])
81 // adj[2] points to triangle sharing edge (vertex[2],vertex[0])
98 double xmin, xmax, ymin, ymax;
108 void ComputeBarycenter (Vertex& v0, Vertex& v1, Vertex& v2, Vertex& ver,
110 int InTriangle (Vertex& v0, Vertex& v1, Vertex& v2, Vertex& test);