[geos-commits] [SCM] GEOS branch main updated. 848f978b8906c9a3515743b52caa86c1ca81d909

git at osgeo.org git at osgeo.org
Fri Sep 17 13:36:28 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, main has been updated
       via  848f978b8906c9a3515743b52caa86c1ca81d909 (commit)
      from  7315c299aaace9fdf9ae55042bc7ae1f32856009 (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 848f978b8906c9a3515743b52caa86c1ca81d909
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Fri Sep 17 13:36:23 2021 -0700

    Fix DiscreteFrechetDistance initialization problem

diff --git a/src/algorithm/distance/DiscreteFrechetDistance.cpp b/src/algorithm/distance/DiscreteFrechetDistance.cpp
index 4068bcb..1ea8509 100644
--- a/src/algorithm/distance/DiscreteFrechetDistance.cpp
+++ b/src/algorithm/distance/DiscreteFrechetDistance.cpp
@@ -109,7 +109,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 a31c26f..1ea5e75 100644
--- a/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
+++ b/tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp
@@ -156,4 +156,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:
 src/algorithm/distance/DiscreteFrechetDistance.cpp            | 2 +-
 tests/unit/algorithm/distance/DiscreteFrechetDistanceTest.cpp | 9 +++++++++
 2 files changed, 10 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list