From 1de448df4a52feaf7de82acffbf4670aff3b89bb Mon Sep 17 00:00:00 2001 From: Don BURNS Date: Thu, 4 Apr 2002 00:30:10 +0000 Subject: [PATCH] Fixed a small bug in compute bound that caused it to come up with the wrong number if the coord array was indexed, and containing bogus (unindexed, yet in-line) numbers. --- src/osg/GeoSet.cpp | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/src/osg/GeoSet.cpp b/src/osg/GeoSet.cpp index 0fe3abcc9..749d32ee9 100644 --- a/src/osg/GeoSet.cpp +++ b/src/osg/GeoSet.cpp @@ -432,10 +432,21 @@ const bool GeoSet::computeBound() const int i; if( _iaformat == IA_OFF ) { - for( i = 0; i < _numcoords; i++ ) - { - center += _coords[i]; - _bbox.expandBy(_coords[i]); + if( _cindex.valid() ) + { + for( i = 0; i < _numcoords; i++ ) + { + center += _coords[_cindex[i]]; + _bbox.expandBy(_coords[_cindex[i]]); + } + } + else + { + for( i = 0; i < _numcoords; i++ ) + { + center += _coords[i]; + _bbox.expandBy(_coords[i]); + } } } else