]> granicus.if.org Git - postgis/commitdiff
bugfix in ptarray_compute_box2d_p
authorSandro Santilli <strk@keybit.net>
Mon, 25 Jul 2005 22:23:48 +0000 (22:23 +0000)
committerSandro Santilli <strk@keybit.net>
Mon, 25 Jul 2005 22:23:48 +0000 (22:23 +0000)
git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@1827 b70326c6-7e19-0410-871a-916f4a2858ee

CHANGES
lwgeom/ptarray.c

diff --git a/CHANGES b/CHANGES
index 1df91fa8cc0163dc8d65be2e5f2e1bd33d8ab840..ee03b50ed7689cc720a333d19c270e626b83343b 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -4,6 +4,7 @@ PostGIS 1.0.3
        - Bugfix in dumper handling of user-defined queries 
        - Bugfix in create_undef.pl script
        - Small performance improvement in canonical input function
+       - Severe bugfix in lwgeom's 2d bounding box computation
 
 PostGIS 1.0.2
 2005/07/04
index 4e4d8fc09c8b14bcdb7d09ed4faf51d003826101..dcb82a99774f7e17b2456de22ea1e02e4dcf1047 100644 (file)
@@ -125,25 +125,28 @@ ptarray_compute_box2d_p(const POINTARRAY *pa, BOX2DFLOAT4 *result)
 {
        int t;
        POINT2D pt;
+       BOX3D box;
 
        if (pa->npoints == 0) return 0;
 
        getPoint2d_p(pa, 0, &pt);
 
-       result->xmin = pt.x;
-       result->xmax = pt.x;
-       result->ymin = pt.y;
-       result->ymax = pt.y;
+       box.xmin = pt.x;
+       box.xmax = pt.x;
+       box.ymin = pt.y;
+       box.ymax = pt.y;
 
        for (t=1; t<pa->npoints; t++)
        {
                getPoint2d_p(pa, t, &pt);
-               if (pt.x < result->xmin) result->xmin = pt.x;
-               if (pt.y < result->ymin) result->ymin = pt.y;
-               if (pt.x > result->xmax) result->xmax = pt.x;
-               if (pt.y > result->ymax) result->ymax = pt.y;
+               if (pt.x < box.xmin) box.xmin = pt.x;
+               if (pt.y < box.ymin) box.ymin = pt.y;
+               if (pt.x > box.xmax) box.xmax = pt.x;
+               if (pt.y > box.ymax) box.ymax = pt.y;
        }
 
+       box3d_to_box2df_p(&box, result);
+
        return 1;
 }