Commit ce1044a7 authored by Frédéric Larue's avatar Frédéric Larue

GLViewer::frameBox() function simplified.

parent 1bb0876c
......@@ -508,17 +508,9 @@ void GLViewer::frameBox( Box3f &box, const QMatrix4x4 *xf )
{
if( !box.IsNull() )
{
double boxHalfDiag = box.Dimensions().length() * 0.5;
double depth = ( 2.0*zFar()*zNear() - distToFocusPoint()*(zFar()+zNear()) ) / (zNear()-zFar());
double projectedRadius = boxHalfDiag * focal() / depth;
if( xf )
setFocusPoint( xf->map(box.Center()) );
else
setFocusPoint( box.Center() );
if( projectedRadius > 0.000001 )
setDistToFocusPoint( distToFocusPoint() * (width()<height()? projectedRadius*height()/width() : projectedRadius) );
double bndgSphRadius = 0.5 * box.Diagonal();
setDistToFocusPoint( bndgSphRadius / std::sin( 0.5*fovY() ) );
setFocusPoint( xf? xf->map(box.Center()) : box.Center() );
}
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment