16 static void mystats(
double,
double,
double,
double,
double *,
double *);
38 double len, area, total_len, total_area;
43 mystats(
x[n - 1], y[n - 1],
x[0], y[0], &total_len, &total_area);
44 for (i = 1; i < n; i++) {
45 mystats(
x[i - 1], y[i - 1],
x[i], y[i], &len, &area);
57 if (total_len < 1.0 && total_len > -1.0)
60 return total_area >= 0.0 ? 1 : -1;
63 static void mystats(
double x0,
double y0,
double x1,
double y1,
double *len,
76 *area = (x0 - x1) * (y0 + y1) / 2.0;
78 *area = (x1 - x0) * (y1 + y0) / 2.0;
int G_pole_in_polygon(const double *x, const double *y, int n)
Check if pole is in polygon.