[GRASS-SVN] r74031 - grass/trunk/lib/vector/Vlib

svn_grass at osgeo.org svn_grass at osgeo.org
Sun Jan 27 12:56:29 PST 2019


Author: mmetz
Date: 2019-01-27 12:56:28 -0800 (Sun, 27 Jan 2019)
New Revision: 74031

Modified:
   grass/trunk/lib/vector/Vlib/intersect2.c
Log:
Vlib: adjust dynamic floating point representation error for squared distances

Modified: grass/trunk/lib/vector/Vlib/intersect2.c
===================================================================
--- grass/trunk/lib/vector/Vlib/intersect2.c	2019-01-27 12:42:22 UTC (rev 74030)
+++ grass/trunk/lib/vector/Vlib/intersect2.c	2019-01-27 20:56:28 UTC (rev 74031)
@@ -208,7 +208,7 @@
 {
     int seg;
     double x, y;
-    double dist, curdist;
+    double dist, curdist, dthresh;
 
     /* 1. of A seg */
     seg = asegment;
@@ -251,7 +251,8 @@
      * the smallest difference representable with 
      * single precision floating point works well with pathological input
      * regular input is not affected */
-    if (curdist < d_ulp(x, y)) {	/* was rethresh * rethresh */
+    dthresh = d_ulp(x, y);
+    if (curdist < dthresh * dthresh) {	/* was rethresh * rethresh */
 	*xc = x;
 	*yc = y;
 



More information about the grass-commit mailing list