]> granicus.if.org Git - postgis/commitdiff
Remove tolerance in point-in-ring stabline tests
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 17 Sep 2019 20:00:09 +0000 (20:00 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 17 Sep 2019 20:00:09 +0000 (20:00 +0000)
References #4506

git-svn-id: http://svn.osgeo.org/postgis/branches/2.5@17816 b70326c6-7e19-0410-871a-916f4a2858ee

NEWS
postgis/lwgeom_functions_analytic.c

diff --git a/NEWS b/NEWS
index 3966cc1d590f4df2b4a4be9e644b6cba009de133..ddf6d59ccee74e84eb4ecc861a347f49b3ba25ae 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -11,6 +11,8 @@ XXXX/XX/XX
   - #4493, Fix ST_RemoveRepeatedPoints output having an outdated bbox (Raúl Marín)
   - #4495, Fix ST_SnapToGrid output having an outdated bbox (Raúl Marín)
   - #4496, Make ST_Simplify(TRIANGLE) collapse if requested (Raúl Marín)
+  - #4506, Remove tolerance in point-in-ring tests (Paul Ramsey)
+
 
 PostGIS 2.5.3
 2019/08/11
index 0b67975d9b55b9b9769193b94ac4778a3e90cd45..88ff1f4a60b07f33d1cd4b8ec7bd347910433466 100644 (file)
@@ -743,7 +743,7 @@ static int point_in_ring_rtree(RTREE_NODE *root, const POINT2D *point)
                 * then the line is to the right of the point and
                 * circling counter-clockwise, so increment.
                 */
-               if (FP_CONTAINS_BOTTOM(seg1->y, point->y, seg2->y) && side>0)
+               if ((seg1->y <= point->y) && (point->y < seg2->y) && (side > 0))
                {
                        POSTGIS_DEBUG(3, "incrementing winding number.");
 
@@ -754,7 +754,7 @@ static int point_in_ring_rtree(RTREE_NODE *root, const POINT2D *point)
                 * then the line is to the right of the point and circling
                 * clockwise, so decrement.
                 */
-               else if (FP_CONTAINS_BOTTOM(seg2->y, point->y, seg1->y) && side<0)
+               else if ((seg2->y <= point->y) && (point->y < seg1->y) && (side < 0))
                {
                        POSTGIS_DEBUG(3, "decrementing winding number.");
 
@@ -798,7 +798,7 @@ static int point_in_ring(POINTARRAY *pts, const POINT2D *point)
                POSTGIS_DEBUGF(3, "counterclockwise wrap %d, clockwise wrap %d", FP_CONTAINS_BOTTOM(seg1->y, point->y, seg2->y), FP_CONTAINS_BOTTOM(seg2->y, point->y, seg1->y));
 
                /* zero length segments are ignored. */
-               if (((seg2->x - seg1->x)*(seg2->x - seg1->x) + (seg2->y - seg1->y)*(seg2->y - seg1->y)) < 1e-12*1e-12)
+               if ((seg2->x == seg1->x) && (seg2->y == seg1->y))
                {
                        POSTGIS_DEBUG(3, "segment is zero length... ignoring.");
 
@@ -822,7 +822,7 @@ static int point_in_ring(POINTARRAY *pts, const POINT2D *point)
                 * then the line is to the right of the point and
                 * circling counter-clockwise, so increment.
                 */
-               if (FP_CONTAINS_BOTTOM(seg1->y, point->y, seg2->y) && side>0)
+               if ((seg1->y <= point->y) && (point->y < seg2->y) && (side > 0))
                {
                        POSTGIS_DEBUG(3, "incrementing winding number.");
 
@@ -833,7 +833,7 @@ static int point_in_ring(POINTARRAY *pts, const POINT2D *point)
                 * then the line is to the right of the point and circling
                 * clockwise, so decrement.
                 */
-               else if (FP_CONTAINS_BOTTOM(seg2->y, point->y, seg1->y) && side<0)
+               else if ((seg2->y <= point->y) && (point->y < seg1->y) && (side < 0))
                {
                        POSTGIS_DEBUG(3, "decrementing winding number.");