From: Sandro Santilli Date: Thu, 8 Sep 2005 23:28:49 +0000 (+0000) Subject: Made ptarray_compute_box3d a wrapper of ptarray_compute_box3d_p X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2eba73076fcad5d265dfaba30b0b3e3aa44b7935;p=postgis Made ptarray_compute_box3d a wrapper of ptarray_compute_box3d_p git-svn-id: http://svn.osgeo.org/postgis/branches/pgis_1_0@1897 b70326c6-7e19-0410-871a-916f4a2858ee --- diff --git a/CHANGES b/CHANGES index dd18184b0..3f725e2d4 100644 --- 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 diff --git a/lwgeom/ptarray.c b/lwgeom/ptarray.c index dcb82a997..bd7c99fee 100644 --- a/lwgeom/ptarray.c +++ b/lwgeom/ptarray.c @@ -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; tnpoints; 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; }