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

git at osgeo.org git at osgeo.org
Tue Jan 14 10:50:10 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, main has been updated
       via  d9a84487f21edc967b137e44a4feb8122f8afbb2 (commit)
      from  3c42d2d52d5df22268dfe58c13f66bc6ef86c423 (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 d9a84487f21edc967b137e44a4feb8122f8afbb2
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 3e6ba54ce..f19a954f1 100644
--- a/include/geos/algorithm/construct/MaximumInscribedCircle.h
+++ b/include/geos/algorithm/construct/MaximumInscribedCircle.h
@@ -136,7 +136,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