[geos-commits] [SCM] GEOS branch main updated. bdef32796de1c05f281c5e2bbfe2f83fc63b0259

git at osgeo.org git at osgeo.org
Tue Jul 8 11:36:51 PDT 2025


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  bdef32796de1c05f281c5e2bbfe2f83fc63b0259 (commit)
      from  29d4f5d030293a9b8254022266e0789a2badc726 (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 bdef32796de1c05f281c5e2bbfe2f83fc63b0259
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Tue Jul 8 11:36:32 2025 -0700

    Fix withinDistance with negative distance value
    
    Closes #1277
    Negative values are now treated as zero.

diff --git a/.gitignore b/.gitignore
index b060ca0e4..e57c23631 100644
--- a/.gitignore
+++ b/.gitignore
@@ -37,3 +37,4 @@ capi/geos_c.h
 .project
 .ccache/
 web/public/
+*.code-workspace
diff --git a/src/operation/distance/DistanceOp.cpp b/src/operation/distance/DistanceOp.cpp
index 18ae46c35..c6da7508f 100644
--- a/src/operation/distance/DistanceOp.cpp
+++ b/src/operation/distance/DistanceOp.cpp
@@ -90,7 +90,7 @@ DistanceOp::DistanceOp(const Geometry& g0, const Geometry& g1):
 DistanceOp::DistanceOp(const Geometry& g0, const Geometry& g1, double tdist)
     :
     geom{{&g0, &g1}},
-    terminateDistance(tdist),
+    terminateDistance(tdist < 0.0 ? 0.0 : tdist),
     minDistance(DoubleInfinity)
 {}
 
diff --git a/src/operation/distance/IndexedFacetDistance.cpp b/src/operation/distance/IndexedFacetDistance.cpp
index a8fe23415..74beff4e8 100644
--- a/src/operation/distance/IndexedFacetDistance.cpp
+++ b/src/operation/distance/IndexedFacetDistance.cpp
@@ -59,6 +59,7 @@ IndexedFacetDistance::distance(const Geometry* g) const
 bool
 IndexedFacetDistance::isWithinDistance(const Geometry* g, double maxDistance) const
 {
+    if (maxDistance < 0.0) maxDistance = 0.0;
     // short-circuit check
     double envDist = baseGeometry.getEnvelopeInternal()->distance(*g->getEnvelopeInternal());
     if (envDist > maxDistance) {

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

Summary of changes:
 .gitignore                                      | 1 +
 src/operation/distance/DistanceOp.cpp           | 2 +-
 src/operation/distance/IndexedFacetDistance.cpp | 1 +
 3 files changed, 3 insertions(+), 1 deletion(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list