[GRASS-SVN] r30051 - grass/branches/releasebranch_6_3/vector/v.generalize

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Feb 10 04:06:56 EST 2008


Author: hamish
Date: 2008-02-10 04:06:56 -0500 (Sun, 10 Feb 2008)
New Revision: 30051

Modified:
   grass/branches/releasebranch_6_3/vector/v.generalize/smoothing.c
Log:
fix for bug #36: patch from Daniel Bundala (bundala gmail com).
  merge from trunk


Modified: grass/branches/releasebranch_6_3/vector/v.generalize/smoothing.c
===================================================================
--- grass/branches/releasebranch_6_3/vector/v.generalize/smoothing.c	2008-02-10 08:56:27 UTC (rev 30050)
+++ grass/branches/releasebranch_6_3/vector/v.generalize/smoothing.c	2008-02-10 09:06:56 UTC (rev 30051)
@@ -258,7 +258,12 @@
 void refine_tangent(POINT * p)
 {
     double l = point_dist2(*p);
-    point_scalar(*p, (double)1.0 / sqrt(sqrt(sqrt(l))), p);
+    if (l < 1e-12) {
+	point_scalar(*p, 0.0, p);
+    }
+    else {
+	point_scalar(*p, (double)1.0 / sqrt(sqrt(sqrt(l))), p);
+    }
     return;
 }
 
@@ -281,7 +286,7 @@
 
     /* line is too short */
     if (n <= 2) {
-	return 1;
+	return n;
     }
 
     /* convert degrees=>radians */



More information about the grass-commit mailing list