From a0c1dcac452ed764ec10996dffc55e4f89910e52 Mon Sep 17 00:00:00 2001 From: Sandro Santilli Date: Mon, 25 Jul 2005 22:24:07 +0000 Subject: [PATCH] bugfix in ptarray_compute_box2d_p git-svn-id: http://svn.osgeo.org/postgis/trunk@1828 b70326c6-7e19-0410-871a-916f4a2858ee --- CHANGES | 1 + lwgeom/ptarray.c | 19 +++++++++++-------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/CHANGES b/CHANGES index b21dec2d9..93c6a25f5 100644 --- 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 diff --git a/lwgeom/ptarray.c b/lwgeom/ptarray.c index d0dc9e0ae..27e107c15 100644 --- a/lwgeom/ptarray.c +++ b/lwgeom/ptarray.c @@ -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; tnpoints; 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; } -- 2.50.1