[geos-commits] [SCM] GEOS branch main-relate-ng updated. 1888b581f77146f16ee5f4d4fa36f97a91270837

git at osgeo.org git at osgeo.org
Mon Jul 29 11:03:02 PDT 2024


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-relate-ng has been updated
       via  1888b581f77146f16ee5f4d4fa36f97a91270837 (commit)
      from  d921cb620da67ec1fe9a2f071eb9e4e9ed8475a9 (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 1888b581f77146f16ee5f4d4fa36f97a91270837
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Jul 29 11:02:37 2024 -0700

    Update PolygonNodeTopology::isCrossing

diff --git a/include/geos/algorithm/PolygonNodeTopology.h b/include/geos/algorithm/PolygonNodeTopology.h
index 7b6508f1d..ca3de04f2 100644
--- a/include/geos/algorithm/PolygonNodeTopology.h
+++ b/include/geos/algorithm/PolygonNodeTopology.h
@@ -110,6 +110,23 @@ private:
         const CoordinateXY* p,
         const CoordinateXY* e0, const CoordinateXY* e1);
 
+    /**
+    * Compares whether an edge p is between or outside the edges e0 and e1,
+    * where the edges all originate at a common origin.
+    * The "inside" of e0 and e1 is the arc which does not include
+    * the positive X-axis at the origin.
+    * If p is collinear with an edge 0 is returned.
+    *
+    * @param origin the origin
+    * @param p the destination point of edge p
+    * @param e0 the destination point of edge e0
+    * @param e1 the destination point of edge e1
+    * @return a negative integer, zero or positive integer as the vector P lies outside, collinear with, or inside the vectors E0 and E1
+    */
+    static int compareBetween(const CoordinateXY* origin, const CoordinateXY* p,
+        const CoordinateXY* e0, const CoordinateXY* e1);
+
+
     /**
     * Tests if the angle with the origin of a vector P is greater than that of the
     * vector Q.
diff --git a/src/algorithm/PolygonNodeTopology.cpp b/src/algorithm/PolygonNodeTopology.cpp
index 7b179c9ae..8449944dd 100644
--- a/src/algorithm/PolygonNodeTopology.cpp
+++ b/src/algorithm/PolygonNodeTopology.cpp
@@ -24,6 +24,7 @@ using geos::geom::Quadrant;
 namespace geos {
 namespace algorithm { // geos.algorithm
 
+
 /* public static */
 bool
 PolygonNodeTopology::isCrossing(const CoordinateXY* nodePt,
@@ -36,16 +37,24 @@ PolygonNodeTopology::isCrossing(const CoordinateXY* nodePt,
         aLo = a1;
         aHi = a0;
     }
+
+    // bool bBetween0 = isBetween(nodePt, b0, aLo, aHi);
+    // bool bBetween1 = isBetween(nodePt, b1, aLo, aHi);
+    // return bBetween0 != bBetween1;
+
     /**
      * Find positions of b0 and b1.
      * If they are the same they do not cross the other edge
      */
-    bool bBetween0 = isBetween(nodePt, b0, aLo, aHi);
-    bool bBetween1 = isBetween(nodePt, b1, aLo, aHi);
+    int compBetween0 = compareBetween(nodePt, b0, aLo, aHi);
+    if (compBetween0 == 0) return false;
+    int compBetween1 = compareBetween(nodePt, b1, aLo, aHi);
+    if (compBetween1 == 0) return false;
 
-    return bBetween0 != bBetween1;
+    return compBetween0 != compBetween1;
 }
 
+
 /* public static */
 bool
 PolygonNodeTopology::isInteriorSegment(const CoordinateXY* nodePt,
@@ -78,6 +87,21 @@ PolygonNodeTopology::isBetween(const CoordinateXY* origin,
 }
 
 
+/* private static */
+int
+PolygonNodeTopology::compareBetween(
+    const CoordinateXY* origin, const CoordinateXY* p,
+    const CoordinateXY* e0, const CoordinateXY* e1)
+{
+    int comp0 = compareAngle(origin, p, e0);
+    if (comp0 == 0) return 0;
+    int comp1 = compareAngle(origin, p, e1);
+    if (comp1 == 0) return 0;
+    if (comp0 > 0 && comp1 < 0) return 1;
+    return -1;
+}
+
+
 /* public static */
 int
 PolygonNodeTopology::compareAngle(
diff --git a/src/operation/relateng/IMPredicate.cpp b/src/operation/relateng/IMPredicate.cpp
index c41be5e8c..3b4411d73 100644
--- a/src/operation/relateng/IMPredicate.cpp
+++ b/src/operation/relateng/IMPredicate.cpp
@@ -140,7 +140,7 @@ IMPredicate::toString() const
 std::ostream&
 operator<<(std::ostream& os, const IMPredicate& imp)
 {
-    os << imp.toString();
+    os << imp.toString() << " " << imp.intMatrix;
     return os;
 }
 
diff --git a/tests/unit/operation/relateng/RelateNGTest.cpp b/tests/unit/operation/relateng/RelateNGTest.cpp
index 8706803c9..c131746da 100644
--- a/tests/unit/operation/relateng/RelateNGTest.cpp
+++ b/tests/unit/operation/relateng/RelateNGTest.cpp
@@ -694,7 +694,6 @@ void object::test<42> ()
   //checkIntersectsDisjoint(a, b, true);
     checkOverlaps(a, b, false);
     checkTouches(a, b, true);
-    checkOverlaps(a, b, false);
 }
 
 // testPolygonsEdgeAdjacent2
@@ -707,7 +706,6 @@ void object::test<43> ()
   //checkIntersectsDisjoint(a, b, true);
     checkOverlaps(a, b, false);
     checkTouches(a, b, true);
-    checkOverlaps(a, b, false);
 }
 
 // testPolygonsNested

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

Summary of changes:
 include/geos/algorithm/PolygonNodeTopology.h   | 17 +++++++++++++++
 src/algorithm/PolygonNodeTopology.cpp          | 30 +++++++++++++++++++++++---
 src/operation/relateng/IMPredicate.cpp         |  2 +-
 tests/unit/operation/relateng/RelateNGTest.cpp |  2 --
 4 files changed, 45 insertions(+), 6 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list