[geos-commits] [SCM] GEOS branch main updated. c11ff3c9917f2387bfbb34331db0021c2b59b3a3
git at osgeo.org
git at osgeo.org
Mon May 5 10:37:48 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 c11ff3c9917f2387bfbb34331db0021c2b59b3a3 (commit)
from 553d99b24f474aec191d4d5c83e7a346dd7ee91f (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 c11ff3c9917f2387bfbb34331db0021c2b59b3a3
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Mon May 5 10:37:24 2025 -0700
Confirm behaviour change against PostGIS test for MaximumInscribedCircle
diff --git a/src/algorithm/construct/ExactMaxInscribedCircle.cpp b/src/algorithm/construct/ExactMaxInscribedCircle.cpp
index 46ce08794..e4a030f41 100644
--- a/src/algorithm/construct/ExactMaxInscribedCircle.cpp
+++ b/src/algorithm/construct/ExactMaxInscribedCircle.cpp
@@ -47,10 +47,9 @@ bool
ExactMaxInscribedCircle::isSupported(const Geometry* geom)
{
/* isSimplePolygon() */
- /* TODO replace with geometryid test */
- const Polygon* polygon = dynamic_cast<const Polygon*>(geom);
- if (polygon == nullptr)
+ if (geom->getGeometryTypeId() != GEOS_POLYGON)
return false;
+ const Polygon* polygon = static_cast<const Polygon*>(geom);
if (polygon->getNumInteriorRing() > 0)
return false;
@@ -226,8 +225,8 @@ ExactMaxInscribedCircle::isConvex(const CoordinateSequence* ring)
return false;
int ringOrient = 0;
for (std::size_t i = 0; i < n - 1; i++) {
- std::size_t i1 = i + 1;
- std::size_t i2 = (i1 >= n - 1) ? 1 : i1 + 1;
+ std::size_t i1 = (i + 1) % (n - 1);
+ std::size_t i2 = (i + 2) % (n - 1);
int orient = Orientation::index(
ring->getAt(i),
ring->getAt(i1),
diff --git a/tests/unit/algorithm/construct/MaximumInscribedCircleTest.cpp b/tests/unit/algorithm/construct/MaximumInscribedCircleTest.cpp
index 7261e3374..b08561e32 100644
--- a/tests/unit/algorithm/construct/MaximumInscribedCircleTest.cpp
+++ b/tests/unit/algorithm/construct/MaximumInscribedCircleTest.cpp
@@ -304,6 +304,18 @@ void object::test<17> ()
0.001, 5.0, 3.3431, 1.65685 );
}
+/* postgis mic-box test */
+template<>
+template<>
+void object::test<18> ()
+{
+ checkCircle("Polygon((0 0, 100 0, 99 98, 0 100, 0 0))",
+ 0.1, 49.5117, 49.5117, 49.47799 );
+}
+
+//-mic-box|POINT(49.5117 49.5117)|POINT(50.5111 98.9796)|49.4779
+//+mic-box|POINT(49.495 49.495)|POINT(50.4947 98.9799)|49.4950
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
src/algorithm/construct/ExactMaxInscribedCircle.cpp | 9 ++++-----
.../unit/algorithm/construct/MaximumInscribedCircleTest.cpp | 12 ++++++++++++
2 files changed, 16 insertions(+), 5 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list