71 #include <grass/Vect.h>
74 int dig_prune(
struct line_pnts *points,
double thresh)
76 double *ox, *oy, *nx, *ny;
82 ja, jd, i, j, k,
n, inu, it;
90 double sx[18], sy[18];
94 if (points->n_points <= 2)
95 return (points->n_points);
102 o_num = points->n_points;
108 while (at_num < o_num) {
122 while (*ox == cur_x && *oy == cur_y) {
157 while (at_num < o_num) {
158 if (o_num - at_num > 14)
177 for (j = at_num; j <
n; j++) {
193 dx = sx[ja] - sx[jd];
194 dy = sy[ja] - sy[jd];
195 t = thresh * hypot(dx, dy);
196 beta = sx[jd] * sy[ja] - sx[ja] * sy[jd];
201 ij = (ja + jd + 1) >> 1;
204 for (j = jd + 1; j < ja; j++) {
205 sqdist = fabs(dx * sy[j] - dy * sx[j] + beta);
206 if (sqdist > fpdist) {
225 for (j = inu - 1; j > 0; j--) {
int dig_prune(struct line_pnts *points, double thresh)