]> granicus.if.org Git - postgis/commitdiff
Drop use of tolerance in PIP (#852)
authorSandro Santilli <strk@keybit.net>
Thu, 19 Jan 2012 08:59:41 +0000 (08:59 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 19 Jan 2012 08:59:41 +0000 (08:59 +0000)
Affects point_in_ring and point_in_ring_rtree.
Includes regress test but not hitting the cache.

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

postgis/lwgeom_functions_analytic.c
regress/tickets.sql
regress/tickets_expected

index b8a4f96accfbd5e8a1bb4f47849c7f885f87157b..6612d90a02d755609f961d79190fe692cd8b487f 100644 (file)
@@ -931,7 +931,8 @@ int point_in_ring_rtree(RTREE_NODE *root, POINT2D *point)
                }
 
                /* a point on the boundary of a ring is not contained. */
-               if (fabs(side) < 1e-12)
+               /* WAS: if (fabs(side) < 1e-12), see #852 */
+               if (side == 0.0)
                {
                        if (isOnSegment(&seg1, &seg2, point) == 1)
                        {
@@ -1010,7 +1011,8 @@ int point_in_ring(POINTARRAY *pts, POINT2D *point)
                }
 
                /* a point on the boundary of a ring is not contained. */
-               if (fabs(side) < 1e-12)
+               /* WAS: if (fabs(side) < 1e-12), see #852 */
+               if (side == 0.0)
                {
                        if (isOnSegment(&seg1, &seg2, point) == 1)
                        {
index cba1487a8483f9173aae9e9d67bd18b1644340fa..03ce97fa06e0a3bb6867db18072b287a2300ce8d 100644 (file)
@@ -535,6 +535,15 @@ SELECT '#1450', GeometryType('POINT(0 0)'::geography), GeometryType('POLYGON EMP
 -- #1482
 select '#1482', ST_Srid('POINT(0 0)'::geography(point, 0)::geometry);
 
+-- #852
+select '#852',
+  st_intersects('POINT(0.5 0.5000000000001)'::geometry, 'POLYGON((0 0, 10 10, 1 0, 0 0))'::geometry),
+  st_intersects('POINT(0.6 0.6000000000001)'::geometry, 'POLYGON((0 0, 10 10, 1 0, 0 0))'::geometry),
+  st_intersects('POINT(0.5 0.500000000001)'::geometry, 'POLYGON((0 0, 1 1, 1 0, 0 0))'::geometry),
+  st_intersects('POINT(0.6 0.600000000001)'::geometry, 'POLYGON((0 0, 1 1, 1 0, 0 0))'::geometry),
+  st_intersects('POINT(0.600000000001 0.600000000001)'::geometry, 'POLYGON((0 0, 1 1, 1 0, 0 0))'::geometry),
+  st_intersects('POINT(0.5 0.5)'::geometry, 'POLYGON((0 0, 1 1, 1 0, 0 0))'::geometry);
+
 -- Clean up
 DELETE FROM spatial_ref_sys;
 
index 507367b406bbf52a7c88cd18983bde2a98798641..7adbab709c6cfb432eb60eb58a4b3d5a2cff90d6 100644 (file)
@@ -179,3 +179,4 @@ ERROR:  MultiSurface cannot contain MultiPoint element
 #745|GEOMETRYCOLLECTION(POLYGON((-72 42 1,-70 43 1,-71 41 1,-72 42 1)))
 #1450|POINT|POLYGON
 #1482|4326
+#852|f|f|f|f|t|t