[geos-commits] [SCM] GEOS branch 3.13 updated. 2aded42b37187190b236dc1f293b9539a876bb90

git at osgeo.org git at osgeo.org
Tue Jan 14 11:00:07 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.13 has been updated
       via  2aded42b37187190b236dc1f293b9539a876bb90 (commit)
      from  f24cf635c8322754695a479c9a9858cb6e15d562 (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 2aded42b37187190b236dc1f293b9539a876bb90
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