[geos-commits] [SCM] GEOS branch master updated. daf8e341becbf7e6bc80735ccbd4e49780848b3e

git at osgeo.org git at osgeo.org
Mon Oct 26 15:25:23 PDT 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  daf8e341becbf7e6bc80735ccbd4e49780848b3e (commit)
       via  81153dee8d4a9ddafdcbe1c60496dec5883f41b0 (commit)
      from  1089651b5b7f8278da1c0138b38a42aaff7fd5a2 (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 daf8e341becbf7e6bc80735ccbd4e49780848b3e
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Oct 26 15:25:19 2020 -0700

    Add coordinate sequence to kdtree in random order https://github.com/locationtech/jts/commit/d73c798f8e54f2c8fbff66e27f2fca24a9ebb710

diff --git a/src/noding/snapround/HotPixelIndex.cpp b/src/noding/snapround/HotPixelIndex.cpp
index 808787a..dc49fad 100644
--- a/src/noding/snapround/HotPixelIndex.cpp
+++ b/src/noding/snapround/HotPixelIndex.cpp
@@ -80,7 +80,17 @@ HotPixelIndex::add(const Coordinate& p)
 void
 HotPixelIndex::add(const CoordinateSequence *pts)
 {
-    for (size_t i = 0, sz = pts->size(); i < sz; i++) {
+    /*
+    * Add the points to the tree in random order
+    * to avoid getting an unbalanced tree from
+    * spatially autocorrelated coordinates
+    */
+    std::vector<int> idxs;
+    for (size_t i = 0, sz = pts->size(); i < sz; i++)
+        idxs.push_back(i);
+
+    std::random_shuffle(idxs.begin(), idxs.end());
+    for (auto i : idxs) {
         add(pts->getAt(i));
     }
 }

commit 81153dee8d4a9ddafdcbe1c60496dec5883f41b0
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date:   Mon Oct 26 15:04:05 2020 -0700

    Minor SnappingNoder performance enhancement by moving test up https://github.com/locationtech/jts/commit/5e9404918adb13796b3d9df7878b0a885cd627c9

diff --git a/include/geos/noding/snap/SnappingNoder.h b/include/geos/noding/snap/SnappingNoder.h
index d8efccc..71662b7 100644
--- a/include/geos/noding/snap/SnappingNoder.h
+++ b/include/geos/noding/snap/SnappingNoder.h
@@ -92,6 +92,10 @@ private:
 
 public:
 
+    /**
+     * Creates a snapping noder using the given snap distance tolerance.
+     * @param p_snapTolerance points are snapped if within this distance
+     */
     SnappingNoder(double p_snapTolerance)
         : snapTolerance(p_snapTolerance)
         , snapIndex(p_snapTolerance)
diff --git a/include/geos/noding/snap/SnappingPointIndex.h b/include/geos/noding/snap/SnappingPointIndex.h
index 9f07afb..7a2d444 100644
--- a/include/geos/noding/snap/SnappingPointIndex.h
+++ b/include/geos/noding/snap/SnappingPointIndex.h
@@ -28,15 +28,28 @@ namespace snap { // geos::noding::snap
 
 class GEOS_DLL SnappingPointIndex {
 
+/**
+ * An index providing fast creation and lookup of snap points.
+ * @author mdavis
+ */
+
 private:
 
     // double snapTolerance;
     std::unique_ptr<index::kdtree::KdTree> snapPointIndex;
 
-
 public:
 
     SnappingPointIndex(double p_snapTolerance);
+
+    /**
+    * Snaps a coordinate to an existing snap point,
+    * if it is within the snap tolerance distance.
+    * Otherwise adds the coordinate to the snap point index.
+    *
+    * @param p the point to snap
+    * @return the point it snapped to, or the input point
+    */
     const geom::Coordinate& snap(const geom::Coordinate& p);
 
 };
diff --git a/src/noding/snap/SnappingIntersectionAdder.cpp b/src/noding/snap/SnappingIntersectionAdder.cpp
index be17458..cc71f4c 100644
--- a/src/noding/snap/SnappingIntersectionAdder.cpp
+++ b/src/noding/snap/SnappingIntersectionAdder.cpp
@@ -53,17 +53,17 @@ SnappingIntersectionAdder::processIntersections(SegmentString* seg0, size_t segI
     const Coordinate& p10 = seg1->getCoordinate(segIndex1);
     const Coordinate& p11 = seg1->getCoordinate(segIndex1 + 1);
 
-    li.computeIntersection(p00, p01, p10, p11);
     /**
-     * Process single point intersections only.
-     * Two-point (collinear) ones are handled by the near-vertex code
+     * Don't node intersections which are just
+     * due to the shared vertex of adjacent segments.
      */
-    if (li.hasIntersection() && li.getIntersectionNum() == 1) {
+    if (!isAdjacent(seg0, segIndex0, seg1, segIndex1)) {
+        li.computeIntersection(p00, p01, p10, p11);
         /**
-        * Don't node intersections which are just
-        * due to the shared vertex of adjacent segments.
-        */
-        if (!isAdjacent(seg0, segIndex0, seg1, segIndex1)) {
+         * Process single point intersections only.
+         * Two-point (collinear) ones are handled by the near-vertex code
+         */
+        if (li.hasIntersection() && li.getIntersectionNum() == 1) {
 
             const Coordinate& intPt = li.getIntersection(0);
             const Coordinate& snapPt = snapPointIndex.snap(intPt);

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

Summary of changes:
 include/geos/noding/snap/SnappingNoder.h      |  4 ++++
 include/geos/noding/snap/SnappingPointIndex.h | 15 ++++++++++++++-
 src/noding/snap/SnappingIntersectionAdder.cpp | 16 ++++++++--------
 src/noding/snapround/HotPixelIndex.cpp        | 12 +++++++++++-
 4 files changed, 37 insertions(+), 10 deletions(-)


hooks/post-receive
-- 
GEOS


More information about the geos-commits mailing list