[geos-commits] [SCM] GEOS branch master updated. 79e011013e7223f822832e39473048320e35f6f2
git at osgeo.org
git at osgeo.org
Thu Oct 1 13:22:54 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 79e011013e7223f822832e39473048320e35f6f2 (commit)
from fd5f9496f229a489612f0422208dd60d04a77b62 (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 79e011013e7223f822832e39473048320e35f6f2
Author: Paul Ramsey <pramsey at cleverelephant.ca>
Date: Thu Oct 1 12:28:52 2020 -0700
Fix HotPixel intersects test https://github.com/locationtech/jts/commit/c1977c8181137e8f705a66f0ea6784f428716953
diff --git a/include/geos/noding/snapround/HotPixel.h b/include/geos/noding/snapround/HotPixel.h
index a694a96..2fca4c1 100644
--- a/include/geos/noding/snapround/HotPixel.h
+++ b/include/geos/noding/snapround/HotPixel.h
@@ -82,7 +82,6 @@ private:
double hpy;
double scaleRound(double val) const;
- geom::Coordinate scaleRound(const geom::Coordinate& p) const;
double scale(double val) const;
diff --git a/include/geos/noding/snapround/HotPixel.inl b/include/geos/noding/snapround/HotPixel.inl
index d694d75..26e5e55 100644
--- a/include/geos/noding/snapround/HotPixel.inl
+++ b/include/geos/noding/snapround/HotPixel.inl
@@ -34,11 +34,6 @@ HotPixel::scaleRound(double val) const
return util::round(val * scaleFactor);
}
-INLINE geom::Coordinate
-HotPixel::scaleRound(const geom::Coordinate& p) const
-{
- return geom::Coordinate(scaleRound(p.x), scaleRound(p.y));
-}
INLINE double
HotPixel::scale(double val) const
diff --git a/src/noding/snapround/HotPixel.cpp b/src/noding/snapround/HotPixel.cpp
index c9740e8..bddafcd 100644
--- a/src/noding/snapround/HotPixel.cpp
+++ b/src/noding/snapround/HotPixel.cpp
@@ -160,13 +160,17 @@ HotPixel::intersectsScaled(double p0x, double p0y, double p1x, double p1y) const
*/
int orientUL = CGAlgorithmsDD::orientationIndex(px, py, qx, qy, minx, maxy);
if (orientUL == 0) {
- if (py < qy) return false;
- return true;
+ // upward segment does not intersect pixel interior
+ if (py < qy) return false;
+ // downward segment must intersect pixel interior
+ return true;
}
int orientUR = CGAlgorithmsDD::orientationIndex(px, py, qx, qy, maxx, maxy);
if (orientUR == 0) {
+ // downward segment does not intersect pixel interior
if (py > qy) return false;
+ // upward segment must intersect pixel interior
return true;
}
// check crossing Top side
@@ -175,7 +179,7 @@ HotPixel::intersectsScaled(double p0x, double p0y, double p1x, double p1y) const
}
int orientLL = CGAlgorithmsDD::orientationIndex(px, py, qx, qy, minx, miny);
- if (orientUL == 0) {
+ if (orientLL == 0) {
// LL corner is the only one in pixel interior
return true;
}
@@ -186,7 +190,9 @@ HotPixel::intersectsScaled(double p0x, double p0y, double p1x, double p1y) const
int orientLR = CGAlgorithmsDD::orientationIndex(px, py, qx, qy, maxx, miny);
if (orientLR == 0) {
+ // upward segment does not intersect pixel interior
if (py < qy) return false;
+ // downward segment must intersect pixel interior
return true;
}
diff --git a/tests/unit/noding/snapround/HotPixelTest.cpp b/tests/unit/noding/snapround/HotPixelTest.cpp
index 9392038..e9f1fb0 100644
--- a/tests/unit/noding/snapround/HotPixelTest.cpp
+++ b/tests/unit/noding/snapround/HotPixelTest.cpp
@@ -308,5 +308,67 @@ void object::test<27>
1.02, 0.98, 1.3, 0.7 );
}
+//-----------------------------
+// Test segments tangent to a corner
+
+// testCornerLLTangent
+template<>
+template<>
+void object::test<28>()
+{
+ checkIntersects("testCornerLLTangent", true, 1, 1, 10,
+ 0.9, 1, 1, 0.9 );
+}
+
+// testCornerLLTangentNoTouch
+template<>
+template<>
+void object::test<29>()
+{
+ checkIntersects("testCornerLLTangentNoTouch", false, 1, 1, 10,
+ 0.9, 0.9, 1, 0.9 );
+}
+
+// testCornerULTangent
+template<>
+template<>
+void object::test<30>()
+{
+ // does not intersect due to open top
+ checkIntersects("testCornerULTangent", false, 1, 1, 10,
+ 0.9, 1, 1, 1.1 );
+}
+
+// testCornerURTangent
+template<>
+template<>
+void object::test<31>()
+{
+ // does not intersect due to open top
+ checkIntersects("testCornerURTangent", false, 1, 1, 10,
+ 1, 1.1, 1.1, 1 );
+}
+
+// testCornerLRTangent
+template<>
+template<>
+void object::test<32>()
+{
+ // does not intersect due to open right side
+ checkIntersects("testCornerLRTangent", false, 1, 1, 10,
+ 1, 0.9, 1.1, 1 );
+}
+
+// testCornerULTouchEnd
+template<>
+template<>
+void object::test<33>()
+{
+ // does not intersect due to bounding box check for open top
+ checkIntersects("testCornerULTouchEnd", false, 1, 1, 10,
+ 0.9, 1.1, 0.95, 1.05 );
+}
+
+
} // namespace tut
-----------------------------------------------------------------------
Summary of changes:
include/geos/noding/snapround/HotPixel.h | 1 -
include/geos/noding/snapround/HotPixel.inl | 5 ---
src/noding/snapround/HotPixel.cpp | 12 ++++--
tests/unit/noding/snapround/HotPixelTest.cpp | 62 ++++++++++++++++++++++++++++
4 files changed, 71 insertions(+), 9 deletions(-)
hooks/post-receive
--
GEOS
More information about the geos-commits
mailing list