]> granicus.if.org Git - postgis/commitdiff
#3108, subdivide dropping some squares
authorPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 12 May 2015 00:01:18 +0000 (00:01 +0000)
committerPaul Ramsey <pramsey@cleverelephant.ca>
Tue, 12 May 2015 00:01:18 +0000 (00:01 +0000)
git-svn-id: http://svn.osgeo.org/postgis/trunk@13489 b70326c6-7e19-0410-871a-916f4a2858ee

liblwgeom/lwgeom.c

index 5a903252522b6edf5bb4b921c6c5032304400aa2..0c4b1c33269c08add29fa690fd758e5c30386c9d 100644 (file)
@@ -1937,10 +1937,15 @@ lwgeom_subdivide_recursive(const LWGEOM *geom, int maxvertices, LWCOLLECTION *co
                        /* Is it because it's a rectangle totally *inside* a polygon? */
                        if ( geom->type == POLYGONTYPE )
                        {
-                               POINT2D pt;
-                               pt.x = clip->xmin;
-                               pt.y = clip->ymin;
-                               if ( lwpoly_contains_point((LWPOLY*)geom, &pt) )
+                               const LWPOLY *poly = (LWPOLY*)geom;
+                               POINT2D pt_ll, pt_lr, pt_ur, pt_ul;
+                               pt_ll.x = pt_ul.x = clip->xmin;
+                               pt_lr.x = pt_ur.x = clip->xmax;
+                               pt_ul.y = pt_ur.y = clip->ymax;
+                               pt_ll.y = pt_lr.y = clip->ymin;
+
+                               if ( lwpoly_contains_point(poly, &pt_ll) || lwpoly_contains_point(poly, &pt_ul) ||
+                                    lwpoly_contains_point(poly, &pt_lr) || lwpoly_contains_point(poly, &pt_ur) )
                                {
                                        /* TODO: Probably just making the clipping box into a polygon is a more */
                                        /* efficient way to do this? */