21 #include <grass/gis.h>
22 #include <grass/Vect.h>
23 #include <grass/glocale.h>
44 struct line_pnts *Points;
45 struct line_cats *SCats, *LCats, *OCats;
53 for (node = 1; node <= nnodes; node++) {
67 G_debug(3,
"nlines = %d", nlines);
69 for (i = 0; i < nlines; i++) {
75 Line = Map->plus.Line[abs(line2)];
78 G_debug(4,
" type = %d", Line->type);
79 if (!(Line->type & (otype &
GV_LINES)))
86 G_debug(4,
" line1 = %d angle1 = %e line2 = %d angle2 = %e",
87 line1, angle1, line2, angle2);
89 if (angle2 == angle1) {
91 double length1, length2;
94 int new_short_line = 0;
95 int short_type, long_type,
type;
96 double x, y, z, nx, ny, nz;
98 G_debug(4,
" identical angles -> clean");
106 Points->y[1], 0.0, 0);
111 np = Points->n_points;
114 Points->y[np - 1], 0.0,
116 Points->y[np - 2], 0.0, 0);
124 Points->y[1], 0.0, 0);
129 np = Points->n_points;
132 Points->y[np - 1], 0.0,
134 Points->y[np - 2], 0.0, 0);
137 G_debug(4,
" length1 = %f length2 = %f", length1,
140 if (length1 < length2) {
153 if (short_line > 0) {
160 x = Points->x[Points->n_points - 2];
161 y = Points->y[Points->n_points - 2];
162 z = Points->z[Points->n_points - 2];
170 if (Points->n_points > 1) {
173 short_type, Points, SCats);
181 if (abs(line1) == abs(line2)) {
183 long_line = new_short_line;
185 long_line = -new_short_line;
193 for (j = 0; j < SCats->n_cats; j++) {
196 for (j = 0; j < LCats->n_cats; j++) {
200 if (long_type == GV_BOUNDARY || short_type == GV_BOUNDARY) {
225 Points->x[Points->n_points - 1] = x;
226 Points->y[Points->n_points - 1] = y;
227 Points->z[Points->n_points - 1] = z;
230 if (Points->n_points > 1) {