[GRASS-SVN] r32816 - in grass-addons/vector: v.buffer2 v.parallel2

svn_grass at osgeo.org svn_grass at osgeo.org
Sat Aug 16 10:20:35 EDT 2008


Author: rmatev
Date: 2008-08-16 10:20:35 -0400 (Sat, 16 Aug 2008)
New Revision: 32816

Modified:
   grass-addons/vector/v.buffer2/vlib_buffer.c
   grass-addons/vector/v.parallel2/vlib_buffer.c
Log:
Fixed bug in straight corner buffers

Modified: grass-addons/vector/v.buffer2/vlib_buffer.c
===================================================================
--- grass-addons/vector/v.buffer2/vlib_buffer.c	2008-08-16 11:53:58 UTC (rev 32815)
+++ grass-addons/vector/v.buffer2/vlib_buffer.c	2008-08-16 14:20:35 UTC (rev 32816)
@@ -794,8 +794,21 @@
     res = extract_inner_contour(pg2, &winding, cPoints);
     while (res != 0) {
         if (winding == 0) {
-            add_line_to_array(cPoints, &arrPoints, &count, &allocated, more);
-            cPoints = Vect_new_line_struct();
+            if (round) {
+                add_line_to_array(cPoints, &arrPoints, &count, &allocated, more);
+                cPoints = Vect_new_line_struct();
+            }
+            else {
+                /* fixes some problems for straight corners buffers... */
+                if (!Vect_point_in_poly(cPoints->x[0], cPoints->y[0], area_outer)) {
+                    if (Vect_get_point_in_poly(cPoints, &px, &py) != 0)
+                        G_fatal_error("Vect_get_point_in_poly() failed.");
+                    if (!point_in_buf(area_outer, px, py, da, db, dalpha)) {
+                        add_line_to_array(cPoints, &arrPoints, &count, &allocated, more);
+                        cPoints = Vect_new_line_struct();
+                    }
+                }
+            }
         }
         res = extract_inner_contour(pg2, &winding, cPoints);
     }

Modified: grass-addons/vector/v.parallel2/vlib_buffer.c
===================================================================
--- grass-addons/vector/v.parallel2/vlib_buffer.c	2008-08-16 11:53:58 UTC (rev 32815)
+++ grass-addons/vector/v.parallel2/vlib_buffer.c	2008-08-16 14:20:35 UTC (rev 32816)
@@ -794,8 +794,21 @@
     res = extract_inner_contour(pg2, &winding, cPoints);
     while (res != 0) {
         if (winding == 0) {
-            add_line_to_array(cPoints, &arrPoints, &count, &allocated, more);
-            cPoints = Vect_new_line_struct();
+            if (round) {
+                add_line_to_array(cPoints, &arrPoints, &count, &allocated, more);
+                cPoints = Vect_new_line_struct();
+            }
+            else {
+                /* fixes some problems for straight corners buffers... */
+                if (!Vect_point_in_poly(cPoints->x[0], cPoints->y[0], area_outer)) {
+                    if (Vect_get_point_in_poly(cPoints, &px, &py) != 0)
+                        G_fatal_error("Vect_get_point_in_poly() failed.");
+                    if (!point_in_buf(area_outer, px, py, da, db, dalpha)) {
+                        add_line_to_array(cPoints, &arrPoints, &count, &allocated, more);
+                        cPoints = Vect_new_line_struct();
+                    }
+                }
+            }
         }
         res = extract_inner_contour(pg2, &winding, cPoints);
     }



More information about the grass-commit mailing list