[geos-commits] [SCM] GEOS branch 3.12 updated. 919bd447e41fc7007537dd7d4ddd3a783c51005d

git at osgeo.org git at osgeo.org
Tue Jan 14 11:00:30 PST 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, 3.12 has been updated
       via  919bd447e41fc7007537dd7d4ddd3a783c51005d (commit)
      from  d65efba97eb6f1af578b14cf751566bdc74dee7d (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 919bd447e41fc7007537dd7d4ddd3a783c51005d
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Tue Jan 14 10:49:42 2025 -0800

    Match JTS MaximumInscribedCircle

diff --git a/include/geos/algorithm/construct/MaximumInscribedCircle.h b/include/geos/algorithm/construct/MaximumInscribedCircle.h
index 1da12c038..b838a177c 100644
--- a/include/geos/algorithm/construct/MaximumInscribedCircle.h
+++ b/include/geos/algorithm/construct/MaximumInscribedCircle.h
@@ -137,7 +137,7 @@ private:
     geom::CoordinateXY radiusPt;
 
     /* private methods */
-    double distanceToBoundary(const geom::Coordinate& c);
+    double distanceToBoundary(geom::Point& pt);
     double distanceToBoundary(double x, double y);
     void compute();
 
diff --git a/src/algorithm/construct/MaximumInscribedCircle.cpp b/src/algorithm/construct/MaximumInscribedCircle.cpp
index 89c910d3b..7dc85b8c6 100644
--- a/src/algorithm/construct/MaximumInscribedCircle.cpp
+++ b/src/algorithm/construct/MaximumInscribedCircle.cpp
@@ -24,6 +24,7 @@
 #include <geos/geom/Geometry.h>
 #include <geos/geom/GeometryFactory.h>
 #include <geos/geom/LineString.h>
+#include <geos/geom/Point.h>
 #include <geos/geom/Polygon.h>
 #include <geos/geom/MultiPolygon.h>
 #include <geos/algorithm/locate/IndexedPointInAreaLocator.h>
@@ -142,22 +143,22 @@ MaximumInscribedCircle::createInitialGrid(const Envelope* env, Cell::CellQueue&
 
 /* private */
 double
-MaximumInscribedCircle::distanceToBoundary(const Coordinate& c)
+MaximumInscribedCircle::distanceToBoundary(double x, double y)
 {
-    std::unique_ptr<Point> pt(factory->createPoint(c));
-    double dist = indexedDistance.distance(pt.get());
-    // double dist = inputGeomBoundary->distance(pt.get());
-    bool isOutside = (Location::EXTERIOR == ptLocator.locate(&c));
-    if (isOutside) return -dist;
-    return dist;
+    Coordinate coord(x, y);
+    std::unique_ptr<Point> pt(factory->createPoint(coord));
+    return distanceToBoundary(*pt.get());
 }
 
 /* private */
 double
-MaximumInscribedCircle::distanceToBoundary(double x, double y)
+MaximumInscribedCircle::distanceToBoundary(Point& pt)
 {
-    Coordinate coord(x, y);
-    return distanceToBoundary(coord);
+    double dist = indexedDistance.distance(&pt);
+    // double dist = inputGeomBoundary->distance(pt.get());
+    bool isOutside = (Location::EXTERIOR == ptLocator.locate(pt.getCoordinate()));
+    if (isOutside) return -dist;
+    return dist;
 }
 
 /* private */
@@ -165,8 +166,7 @@ MaximumInscribedCircle::Cell
 MaximumInscribedCircle::createInteriorPointCell(const Geometry* geom)
 {
     std::unique_ptr<Point> p = geom->getInteriorPoint();
-    Coordinate c(p->getX(), p->getY());
-    Cell cell(p->getX(), p->getY(), 0, distanceToBoundary(c));
+    Cell cell(p->getX(), p->getY(), 0, distanceToBoundary(*p.get()));
     return cell;
 }
 

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

Summary of changes:
 .../algorithm/construct/MaximumInscribedCircle.h   |  2 +-
 src/algorithm/construct/MaximumInscribedCircle.cpp | 24 +++++++++++-----------
 2 files changed, 13 insertions(+), 13 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list