From: Sandro Santilli Date: Thu, 19 Jan 2012 08:59:41 +0000 (+0000) Subject: Drop use of tolerance in PIP (#852) X-Git-Tag: 2.0.0alpha1~9 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=f50d10ed8dcd643a42091d9ad420ca225aacece4;p=postgis Drop use of tolerance in PIP (#852) 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 --- diff --git a/postgis/lwgeom_functions_analytic.c b/postgis/lwgeom_functions_analytic.c index b8a4f96ac..6612d90a0 100644 --- a/postgis/lwgeom_functions_analytic.c +++ b/postgis/lwgeom_functions_analytic.c @@ -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) { diff --git a/regress/tickets.sql b/regress/tickets.sql index cba1487a8..03ce97fa0 100644 --- a/regress/tickets.sql +++ b/regress/tickets.sql @@ -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; diff --git a/regress/tickets_expected b/regress/tickets_expected index 507367b40..7adbab709 100644 --- a/regress/tickets_expected +++ b/regress/tickets_expected @@ -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