29 static double d_atan2(
double,
double);
62 for (i = 1; i < n_points - 1; i++) {
63 if ((thresh < fabs(*xptr - last_x)) ||
64 (thresh < fabs(*yptr - last_y))) {
77 return ((
float)d_atan2(yarray[1] - last_y, xarray[1] - last_x));
80 return ((
float)d_atan2(*yptr - last_y, *xptr - last_x));
105 last_x = *(xarray + n_points - 1);
106 last_y = *(yarray + n_points - 1);
107 xptr = xarray + n_points - 2;
108 yptr = yarray + n_points - 2;
114 for (i = n_points - 2; i > 0; i--) {
115 if ((thresh < fabs(*xptr - last_x)) ||
116 (thresh < fabs(*yptr - last_y))) {
128 return ((
float)d_atan2(yarray[n_points - 2] - last_y,
129 xarray[n_points - 2] - last_x));
132 return ((
float)d_atan2(*yptr - last_y, *xptr - last_x));
144 const double *xarray;
145 const double *yarray;
158 for (i = 1; i < n_points; i++) {
159 if ((thresh < fabs(*xptr - last_x)) ||
160 (thresh < fabs(*yptr - last_y))) {
184 G_debug(5,
"dig_line_degenerate()");
189 G_debug(5,
" Line is degenerate (one points)");
195 for (i = 1; i < n_points; i++) {
196 if (points->
x[i] != points->
x[i - 1] ||
197 points->
y[i] != points->
y[i - 1]) {
204 G_debug(5,
" Line is degenerate (more points)");
211 static double d_atan2(
double y,
double x)
213 if (y == 0.0 &&
x == 0.0)
216 return (atan2(y,
x));
float dig_calc_end_angle(const struct line_pnts *points, double thresh)
float dig_calc_begin_angle(const struct line_pnts *points, double thresh)
int dig_line_degenerate(const struct line_pnts *points)
int dig_is_line_degenerate(const struct line_pnts *points, double thresh)
int G_debug(int, const char *,...) __attribute__((format(printf
Feature geometry info - coordinates.
double * y
Array of Y coordinates.
double * x
Array of X coordinates.
int n_points
Number of points.