Added handling of zero radius models
This commit is contained in:
parent
7f370bdfc6
commit
da6b4df00a
@ -96,8 +96,10 @@ void CameraManipulator::computeHomePosition(const osg::Camera *camera, bool useB
|
||||
OSG_INFO<<" boundingSphere.center() = ("<<boundingSphere.center()<<")"<<std::endl;
|
||||
OSG_INFO<<" boundingSphere.radius() = "<<boundingSphere.radius()<<std::endl;
|
||||
|
||||
double radius = osg::maximum(double(boundingSphere.radius()), 1e-6);
|
||||
|
||||
// set dist to default
|
||||
double dist = 3.5f * boundingSphere.radius();
|
||||
double dist = 3.5f * radius;
|
||||
|
||||
if (camera)
|
||||
{
|
||||
@ -110,7 +112,7 @@ void CameraManipulator::computeHomePosition(const osg::Camera *camera, bool useB
|
||||
double horizontal2 = fabs(top - bottom) / zNear / 2.;
|
||||
double dim = horizontal2 < vertical2 ? horizontal2 : vertical2;
|
||||
double viewAngle = atan2(dim,1.);
|
||||
dist = boundingSphere.radius() / sin(viewAngle);
|
||||
dist = radius / sin(viewAngle);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user