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))) {
76 return ((
float)d_atan2(yarray[1] - last_y, xarray[1] - last_x));
79 return ((
float)d_atan2(*yptr - last_y, *xptr - last_x));
104 last_x = *(xarray + n_points - 1);
105 last_y = *(yarray + n_points - 1);
106 xptr = xarray + n_points - 2;
107 yptr = yarray + n_points - 2;
113 for (i = n_points - 2; i > 0; i--) {
114 if ((thresh < fabs(*xptr - last_x)) ||
115 (thresh < fabs(*yptr - last_y))) {
128 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))) {
185 G_debug(5,
"dig_line_degenerate()");
190 G_debug(5,
" Line is degenerate (one points)");
196 for (i = 1; i < n_points; i++) {
197 if (points->
x[i] != points->
x[i - 1] ||
198 points->
y[i] != points->
y[i - 1]) {
205 G_debug(5,
" Line is degenerate (more points)");
212 static double d_atan2(
double y,
double x)
214 if (y == 0.0 && x == 0.0)
217 return (atan2(y, x));
float dig_calc_begin_angle(const struct line_pnts *points, double thresh)
int dig_is_line_degenerate(const struct line_pnts *points, double thresh)
int n_points
Number of points.
double * x
Array of X coordinates.
int dig_line_degenerate(const struct line_pnts *points)
Feature geometry info - coordinates.
float dig_calc_end_angle(const struct line_pnts *points, double thresh)
double * y
Array of Y coordinates.
int G_debug(int, const char *,...) __attribute__((format(printf