[geos-commits] [SCM] GEOS branch 3.8 updated. 5b241bc9436fad3a87449dae67e68b98b5c533b7

git at osgeo.org git at osgeo.org
Fri Sep 17 15:31:36 PDT 2021


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, 3.8 has been updated
       via  5b241bc9436fad3a87449dae67e68b98b5c533b7 (commit)
      from  10a38df5aa2f890df729a3c7d405efa48dca333f (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 5b241bc9436fad3a87449dae67e68b98b5c533b7
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Fri Sep 17 15:31:30 2021 -0700

    Fix DiscreteFrechetDistance initialization problem

diff --git a/NEWS b/NEWS
index 46038f4..7a1963c 100644
--- a/NEWS
+++ b/NEWS
@@ -5,7 +5,7 @@ Changes in 3.8.3
 - Bug fixes / improvements
   - Add void to no-argument prototypes. References libgeos#437 (Paul Ramsey)
   - Fix BufferOp to avoid artifacts in certain polygon buffers (#1101, Martin Davis)
-
+  - Fix DiscreteFrechetDistance to use initial points of input lines (#1128, Martin Davis)
 
 Changes in 3.8.2
 2021-04-10
diff --git a/src/algorithm/distance/DiscreteFrechetDistance.cpp b/src/algorithm/distance/DiscreteFrechetDistance.cpp
index b41225f..4e5cc66 100644
--- a/src/algorithm/distance/DiscreteFrechetDistance.cpp
+++ b/src/algorithm/distance/DiscreteFrechetDistance.cpp
@@ -91,7 +91,7 @@ DiscreteFrechetDistance::getFrecheDistance(std::vector< std::vector<PointPairDis
     }
     p_ptDist.initialize(getSegementAt(p, i), getSegementAt(q, j));
     if(i == 0 && j == 0) {
-        ca[i][j] = ptDist;
+        ca[i][j] = p_ptDist;
     }
     else if(i > 0 && j == 0) {
         PointPairDistance nextDist = getFrecheDistance(ca, i - 1, 0, p, q);
diff --git a/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp b/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
index 203657d..effe5a8 100644
--- a/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
+++ b/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
@@ -132,4 +132,13 @@ void object::test<4>
     runTest("LINESTRING (0 0, 100 0)", "LINESTRING (0 0, 50 50, 100 0)", 0.5, 50.0);
 }
 
+// 5 - test Line Segments revealing distance intialization bug
+template<>
+template<>
+void object::test<5>
+()
+{
+    runTest("LINESTRING (1 1, 2 2)", "LINESTRING (1 4, 2 3)", 3);
+}
+
 } // namespace tut

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

Summary of changes:
 NEWS                                                          | 2 +-
 src/algorithm/distance/DiscreteFrechetDistance.cpp            | 2 +-
 tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp | 9 +++++++++
 3 files changed, 11 insertions(+), 2 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list