[postgis-tickets] r17815 - Remove tolerance in point-in-ring stabline tests

Paul Ramsey pramsey at cleverelephant.ca
Tue Sep 17 12:58:53 PDT 2019


Author: pramsey
Date: 2019-09-17 12:58:52 -0700 (Tue, 17 Sep 2019)
New Revision: 17815

Modified:
   branches/2.4/NEWS
   branches/2.4/postgis/lwgeom_functions_analytic.c
Log:
Remove tolerance in point-in-ring stabline tests
References #4506


Modified: branches/2.4/NEWS
===================================================================
--- branches/2.4/NEWS	2019-09-17 17:16:17 UTC (rev 17814)
+++ branches/2.4/NEWS	2019-09-17 19:58:52 UTC (rev 17815)
@@ -10,6 +10,7 @@
   - #4494, Fix ST_Simplify output having an outdated bbox (Raúl Marín)
   - #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)
+  - #4506, Remove tolerance in point-in-ring stabline tests (Paul Ramsey)
 
 
 PostGIS 2.4.8

Modified: branches/2.4/postgis/lwgeom_functions_analytic.c
===================================================================
--- branches/2.4/postgis/lwgeom_functions_analytic.c	2019-09-17 17:16:17 UTC (rev 17814)
+++ branches/2.4/postgis/lwgeom_functions_analytic.c	2019-09-17 19:58:52 UTC (rev 17815)
@@ -770,7 +770,7 @@
 		 * then the line is to the right of the point and
 		 * circling counter-clockwise, so incremement.
 		 */
-		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.");
 
@@ -781,7 +781,7 @@
 		 * 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.");
 
@@ -825,7 +825,7 @@
 		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.");
 
@@ -849,7 +849,7 @@
 		 * then the line is to the right of the point and
 		 * circling counter-clockwise, so incremement.
 		 */
-		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.");
 
@@ -860,7 +860,7 @@
 		 * 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.");
 



More information about the postgis-tickets mailing list