18 #define TWOPI M_PI + M_PI
22 double QbarA, QbarB, QbarC, QbarD;
33 static double Q(
double x)
40 return sinx * (1 + sinx2 * (
st->QA + sinx2 * (
st->QB + sinx2 *
st->QC)));
43 static double Qbar(
double x)
52 cosx2 * (
st->QbarB + cosx2 * (
st->QbarC + cosx2 *
st->QbarD)));
73 st->AE = a * a * (1 - e2);
75 st->QA = (2.0 / 3.0) * e2;
76 st->QB = (3.0 / 5.0) * e4;
77 st->QC = (4.0 / 7.0) * e6;
79 st->QbarA = -1.0 - (2.0 / 3.0) * e2 - (3.0 / 5.0) * e4 - (4.0 / 7.0) * e6;
80 st->QbarB = (2.0 / 9.0) * e2 + (2.0 / 5.0) * e4 + (4.0 / 7.0) * e6;
81 st->QbarC = -(3.0 / 25.0) * e4 - (12.0 / 35.0) * e6;
82 st->QbarD = (4.0 / 49.0) * e6;
136 double x1, y1, x2, y2, dx, dy;
158 while (x1 - x2 >
M_PI)
161 while (x2 - x1 >
M_PI)
167 if (fabs(dy) > thresh) {
169 area += dx * (
st->Qp - (Qbar2 - Qbar1) / dy);
182 area += dx * (
st->Qp - Q((y1 + y2) / 2));
185 if ((area *=
st->AE) < 0.0)
195 if (area >
st->E / 2)
void G_begin_ellipsoid_polygon_area(double a, double e2)
Begin area calculations.
double G_ellipsoid_polygon_area(const double *lon, const double *lat, int n)
Area of lat-long polygon.