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

CHANGES
lwgeom/ptarray.c

diff --git a/CHANGES b/CHANGES
index b21dec2d928bb1b7325f9fb6125604c6058a639e..93c6a25f5dfc54542466bf35af2e9ce7f1e1a20e 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -17,6 +17,7 @@ PostGIS 1.1.0CVS
 
 PostGIS 1.0.3
 ????/??/??
+       - Severe bugfix in lwgeom's 2d bounding box computation
        - Bugfix in dumper on 64bit machines
        - Bugfix in dumper handling of user-defined queries 
        - Bugfix in create_undef.pl script
index d0dc9e0ae3c68f18325c734013050a153a71ef22..27e107c1596c11eefa694c68f6babe472df604a5 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;
 }