Fixed the compute of the extents/bounding sphere

This commit is contained in:
Robert Osfield 2009-08-27 19:25:23 +00:00
parent ca78f3a6bc
commit 79f780d4b8
2 changed files with 21 additions and 2 deletions

View File

@ -85,7 +85,14 @@ bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::V
if (corners.empty()) return false;
for(Corners::iterator itr = corners.begin();
Corners::iterator itr = corners.begin();
bottomLeft.x() = topRight.x() = itr->x();
bottomLeft.y() = topRight.y() = itr->y();
++itr;
for(;
itr != corners.end();
++itr)
{

View File

@ -12,6 +12,8 @@
*/
#include <osgVolume/Locator>
#include <osg/io_utils>
#include <osg/Notify>
#include <list>
@ -107,6 +109,8 @@ bool Locator::computeLocalBounds(Locator& source, osg::Vec3d& bottomLeft, osg::V
bool Locator::computeLocalBounds(osg::Vec3d& bottomLeft, osg::Vec3d& topRight) const
{
osg::notify(osg::NOTICE)<<"Locator::computeLocalBounds"<<std::endl;
typedef std::list<osg::Vec3d> Corners;
Corners corners;
@ -153,7 +157,15 @@ bool Locator::computeLocalBounds(osg::Vec3d& bottomLeft, osg::Vec3d& topRight) c
if (corners.empty()) return false;
for(Corners::iterator itr = corners.begin();
Corners::iterator itr = corners.begin();
bottomLeft.x() = topRight.x() = itr->x();
bottomLeft.y() = topRight.y() = itr->y();
bottomLeft.z() = topRight.z() = itr->z();
++itr;
for(;
itr != corners.end();
++itr)
{