[geos-commits] [SCM] GEOS branch master updated. 2a0e6675221a3e0d21bfd32313c24ec159814bba

git at osgeo.org git at osgeo.org
Tue Nov 3 13:49:28 PST 2020


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, master has been updated
       via  2a0e6675221a3e0d21bfd32313c24ec159814bba (commit)
       via  1198e06ef656ffdce71d1a3bc6e65cd146056677 (commit)
       via  6a0cb9e5abdd3e76bfbb807c7bb3f99bfbfe7520 (commit)
      from  b03d45bf4c7bf55c087260728579e656d2299bf7 (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 2a0e6675221a3e0d21bfd32313c24ec159814bba
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Tue Nov 3 13:40:33 2020 -0800

    Add QuadEdge output

diff --git a/include/geos/triangulate/quadedge/QuadEdge.h b/include/geos/triangulate/quadedge/QuadEdge.h
index 51513bb..44e4911 100644
--- a/include/geos/triangulate/quadedge/QuadEdge.h
+++ b/include/geos/triangulate/quadedge/QuadEdge.h
@@ -436,10 +436,10 @@ public:
     std::unique_ptr<geom::LineSegment> toLineSegment() const;
 };
 
+GEOS_DLL std::ostream& operator<< (std::ostream& os, const QuadEdge* e);
 
 } //namespace geos.triangulate.quadedge
 } //namespace geos.triangulate
 } //namespace geos
 
 #endif //GEOS_TRIANGULATE_QUADEDGE_QUADEDGE_H
-
diff --git a/src/triangulate/quadedge/QuadEdge.cpp b/src/triangulate/quadedge/QuadEdge.cpp
index 344c6ec..c692580 100644
--- a/src/triangulate/quadedge/QuadEdge.cpp
+++ b/src/triangulate/quadedge/QuadEdge.cpp
@@ -118,7 +118,13 @@ QuadEdge::toLineSegment() const
                new geom::LineSegment(vertex.getCoordinate(), dest().getCoordinate()));
 }
 
+std::ostream&
+operator<< (std::ostream& os, const QuadEdge* e)
+{
+    os << "( " << e->orig().getCoordinate() << ", " << e->dest().getCoordinate() << " )";
+    return os;
+}
+
 } //namespace geos.triangulate.quadedge
 } //namespace geos.triangulate
 } //namespace goes
-

commit 1198e06ef656ffdce71d1a3bc6e65cd146056677
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Tue Nov 3 13:38:04 2020 -0800

    Simplify logic for edge erase-remove

diff --git a/src/triangulate/quadedge/QuadEdgeSubdivision.cpp b/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
index 6629002..14c07fa 100644
--- a/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
+++ b/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
@@ -133,11 +133,8 @@ QuadEdgeSubdivision::remove(QuadEdge& e)
     // rot edges do not need to be tested because they are not removed
     quadEdges.erase(
             std::remove_if(quadEdges.begin(), quadEdges.end(),
-                           [e](QuadEdgeQuartet& es) { return &es.base() == &e; }),
-            quadEdges.end());
-    quadEdges.erase(
-            std::remove_if(quadEdges.begin(), quadEdges.end(),
-                           [e](QuadEdgeQuartet& es) { return &es.base() == &e.sym(); }),
+                           [e](QuadEdgeQuartet& es) {
+                               return &es.base() == &e || &es.base() == &e.sym(); }),
             quadEdges.end());
     //mark these edges as removed
     e.remove();

commit 6a0cb9e5abdd3e76bfbb807c7bb3f99bfbfe7520
Author: Martin Davis <mtnclimb at gmail.com>
Date:   Tue Nov 3 13:14:23 2020 -0800

    Fix QuadEdgeSubdivision remove method

diff --git a/src/triangulate/quadedge/QuadEdgeSubdivision.cpp b/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
index 1a4e249..6629002 100644
--- a/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
+++ b/src/triangulate/quadedge/QuadEdgeSubdivision.cpp
@@ -129,11 +129,16 @@ QuadEdgeSubdivision::remove(QuadEdge& e)
     QuadEdge::splice(e.sym(), e.sym().oPrev());
 
     // this is inefficient but this should be called infrequently
+    // check base edge against both edge and sym, since either may be removed
+    // rot edges do not need to be tested because they are not removed
     quadEdges.erase(
             std::remove_if(quadEdges.begin(), quadEdges.end(),
-                           [&e](QuadEdgeQuartet& es) { return &es.base() == &e; }),
+                           [e](QuadEdgeQuartet& es) { return &es.base() == &e; }),
+            quadEdges.end());
+    quadEdges.erase(
+            std::remove_if(quadEdges.begin(), quadEdges.end(),
+                           [e](QuadEdgeQuartet& es) { return &es.base() == &e.sym(); }),
             quadEdges.end());
-
     //mark these edges as removed
     e.remove();
 
diff --git a/tests/unit/triangulate/DelaunayTest.cpp b/tests/unit/triangulate/DelaunayTest.cpp
index aa8b168..50ff9df 100644
--- a/tests/unit/triangulate/DelaunayTest.cpp
+++ b/tests/unit/triangulate/DelaunayTest.cpp
@@ -227,6 +227,34 @@ void object::test<10>
     }
 }
 
+// 11 - Regular grid of points, tol = 0 (see https://trac.osgeo.org/geos/ticket/1035)
+template<>
+template<>
+void object::test<11>
+()
+{
+    const char* wkt =
+"MULTIPOINT ((-10 40), (5 40), (20 40), (-10 55), (5 55), (20 55), (-10 70), (5 70), (20 70))";
+    const char* expectedEdges =
+        "GEOMETRYCOLLECTION (POLYGON ((5 70, 20 70, 20 55, 5 70)), POLYGON ((5 55, 20 55, 20 40, 5 55)), POLYGON ((5 55, 5 70, 20 55, 5 55)), POLYGON ((5 40, 5 55, 20 40, 5 40)), POLYGON ((-10 70, 5 70, 5 55, -10 70)), POLYGON ((-10 55, 5 55, 5 40, -10 55)), POLYGON ((-10 55, -10 70, 5 55, -10 55)), POLYGON ((-10 40, -10 55, 5 40, -10 40)))";
+    if(sizeof(long double) > sizeof(double)) {
+        runDelaunay(wkt, true, expectedEdges, 0.0);
+    }
+}
 
-} // namespace tut
+// 12 - Regular grid of points, tol > 0 (see https://trac.osgeo.org/geos/ticket/1035)
+template<>
+template<>
+void object::test<12>
+()
+{
+    const char* wkt =
+"MULTIPOINT ((-10 40), (5 40), (20 40), (-10 55), (5 55), (20 55), (-10 70), (5 70), (20 70))";
+    const char* expectedEdges =
+        "GEOMETRYCOLLECTION (POLYGON ((5 70, 20 70, 20 55, 5 70)), POLYGON ((5 55, 20 55, 20 40, 5 55)), POLYGON ((5 55, 5 70, 20 55, 5 55)), POLYGON ((5 40, 5 55, 20 40, 5 40)), POLYGON ((-10 70, 5 70, 5 55, -10 70)), POLYGON ((-10 55, 5 55, 5 40, -10 55)), POLYGON ((-10 55, -10 70, 5 55, -10 55)), POLYGON ((-10 40, -10 55, 5 40, -10 40)))";
+    if(sizeof(long double) > sizeof(double)) {
+        runDelaunay(wkt, true, expectedEdges, 0.01);
+    }
+}
 
+} // namespace tut

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

Summary of changes:
 include/geos/triangulate/quadedge/QuadEdge.h     |  2 +-
 src/triangulate/quadedge/QuadEdge.cpp            |  8 ++++++-
 src/triangulate/quadedge/QuadEdgeSubdivision.cpp |  6 +++--
 tests/unit/triangulate/DelaunayTest.cpp          | 30 +++++++++++++++++++++++-
 4 files changed, 41 insertions(+), 5 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list