]> granicus.if.org Git - postgis/commitdiff
Made ptarray_compute_box3d a wrapper of ptarray_compute_box3d_p
authorSandro Santilli <strk@keybit.net>
Thu, 8 Sep 2005 23:28:49 +0000 (23:28 +0000)
committerSandro Santilli <strk@keybit.net>
Thu, 8 Sep 2005 23:28:49 +0000 (23:28 +0000)
git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@1897 b70326c6-7e19-0410-871a-916f4a2858ee

CHANGES
lwgeom/ptarray.c

diff --git a/CHANGES b/CHANGES
index dd18184b0f51aeb81bde665661cc7c059f7cd363..3f725e2d4cd38baf7c08716dc701916373bcadd8 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -10,6 +10,7 @@ PostGIS 1.0.4
        - Documentation improvements
        - More robust selectivity estimator 
        - Minor speedup in distance()
+       - Minor cleanups 
 
 PostGIS 1.0.3
 2005/08/08
index dcb82a99774f7e17b2456de22ea1e02e4dcf1047..bd7c99fee9336289e993bcf3b528c42ab35c80ec 100644 (file)
@@ -364,62 +364,14 @@ BOX3D *
 ptarray_compute_box3d(const POINTARRAY *pa)
 {
        int t;
-       BOX3D *result;
-       POINT3DZ pt;
+       BOX3D *result = lwalloc(sizeof(BOX3D));
 
-#ifdef PGIS_DEBUG
-       lwnotice("ptarray_compute_box3d call (array has %d points)", pa->npoints);
-#endif
-       if (pa->npoints == 0)
+       if ( ! ptarray_compute_box3d_p(pa, result) )
        {
-#ifdef PGIS_DEBUG
-               lwnotice("ptarray_compute_box3d returning NULL");
-#endif
+               lwfree(result);
                return NULL;
        }
 
-       result = lwalloc(sizeof(BOX3D));
-
-       getPoint3dz_p(pa, 0, &pt);
-
-#ifdef PGIS_DEBUG
-       lwnotice("ptarray_compute_box3d: got point 0");
-#endif
-
-       result->xmin = pt.x;
-       result->xmax = pt.x;
-       result->ymin = pt.y;
-       result->ymax = pt.y;
-
-       if ( TYPE_HASZ(pa->dims) ) {
-               result->zmin = pt.z;
-               result->zmax = pt.z;
-       } else {
-               result->zmin = NO_Z_VALUE;
-               result->zmax = NO_Z_VALUE;
-       }
-
-#ifdef PGIS_DEBUG
-       lwnotice("ptarray_compute_box3d: scanning other %d points", pa->npoints);
-#endif
-       for (t=1; t<pa->npoints; t++)
-       {
-               getPoint3dz_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 ( TYPE_HASZ(pa->dims) ) {
-                       if (pt.z > result->zmax) result->zmax = pt.z;
-                       if (pt.z < result->zmin) result->zmin = pt.z;
-               }
-       }
-
-#ifdef PGIS_DEBUG
-       lwnotice("ptarray_compute_box3d returning box");
-#endif
-
        return result;
 }