19 static int mystats(
double,
double,
double,
double,
double *,
double *);
41 double len, area, total_len, total_area;
46 mystats(x[n - 1], y[n - 1], x[0], y[0], &total_len, &total_area);
47 for (i = 1; i <
n; i++) {
48 mystats(x[i - 1], y[i - 1], x[i], y[i], &len, &area);
60 if (total_len < 1.0 && total_len > -1.0)
63 return total_area >= 0.0 ? 1 : -1;
66 static int mystats(
double x0,
double y0,
double x1,
double y1,
double *len,
79 *area = (x0 - x1) * (y0 + y1) / 2.0;
81 *area = (x1 - x0) * (y1 + y0) / 2.0;
int G_pole_in_polygon(const double *x, const double *y, int n)
pole in polygon