[geos-commits] [SCM] GEOS branch master updated. b0504db56985a34c9c097b502c5878795d454b3b

git at osgeo.org git at osgeo.org
Thu Dec 27 11:36:23 PST 2018


This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "GEOS".

The branch, master has been updated
       via  b0504db56985a34c9c097b502c5878795d454b3b (commit)
      from  030e9ae9f93b4ed60bf8e4140bde9df57a07e396 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b0504db56985a34c9c097b502c5878795d454b3b
Author: Daniel Baston <dbaston at gmail.com>
Date:   Sat Dec 22 13:19:03 2018 -0500

    Improve orientationIndex performance with fast filter
    
    JTS r623

diff --git a/src/algorithm/CGAlgorithmsDD.cpp b/src/algorithm/CGAlgorithmsDD.cpp
index 5022ee2..30f1c49 100644
--- a/src/algorithm/CGAlgorithmsDD.cpp
+++ b/src/algorithm/CGAlgorithmsDD.cpp
@@ -27,7 +27,11 @@ using namespace geos::algorithm;
 
 namespace {
 
-double const DP_SAFE_EPSILON =  1e-15;
+/**
+ * A value which is safely greater than the relative round-off
+ * error in double-precision numbers
+ */
+double constexpr DP_SAFE_EPSILON =  1e-15;
 
 inline int OrientationDD(DD const& dd)
 {
@@ -57,11 +61,20 @@ int CGAlgorithmsDD::orientationIndex(const Coordinate& p1,
     if (ISNAN(q.x) || ISNAN(q.y) || !FINITE(q.x) || !FINITE(q.y)) {
         throw util::IllegalArgumentException("CGAlgorithmsDD::orientationIndex encountered NaN/Inf numbers");
     }
-    static DD const zero(0.0);
+
+    // fast filter for orientation index
+    // avoids use of slow extended-precision arithmetic in many cases
+    int index = orientationIndexFilter(p1, p2, q);
+    if (index <= 1)
+        return index;
+
+    // normalize coordinates
     DD dx1 = DD(p2.x) + DD(-p1.x);
     DD dy1 = DD(p2.y) + DD(-p1.y);
     DD dx2 = DD(q.x) + DD(-p2.x);
     DD dy2 = DD(q.y) + DD(-p2.y);
+
+    // sign of determinant - inlined for performance
     DD mx1y2(dx1 * dy2);
     DD my1x2(dy1 * dx2);
     DD d = mx1y2 - my1x2;
@@ -168,7 +181,6 @@ void CGAlgorithmsDD::intersection(const Coordinate& p1, const Coordinate& p2,
 
     rv.x = x.ToDouble();
     rv.y = y.ToDouble();
-    return;
 }
 
 

-----------------------------------------------------------------------

Summary of changes:
 src/algorithm/CGAlgorithmsDD.cpp | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list