openscenegraph / OpenSceneGraph

OpenSceneGraph git repository

Home Page:http://www.openscenegraph.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Should naming be exchanged?

dansirming opened this issue · comments

the code as follow:

 void CameraManipulator::computeHomePosition(const osg::Camera *camera, bool useBoundingBox)
{
      ..........
      if (camera->getProjectionMatrixAsFrustum(left,right,bottom,top,zNear,zFar))
            {
                **double vertical2 = fabs(right - left) / zNear / 2.;
                double horizontal2 = fabs(top - bottom) / zNear / 2.;**
               ...........
            }
            ..........
}

I think the code of bold should be as follow:

double horizontal2 = fabs(right - left) / zNear / 2.;
double  vertical2 = fabs(top - bottom) / zNear / 2.;

Names should be exchanged to avoid misunderstandings!Is it because I misunderstood this code?

Well spotted, it looks like this typo has been sitting there in the code quite some while. For future reference the problem code is:

https://github.com/openscenegraph/OpenSceneGraph/blob/master/src/osgGA/CameraManipulator.cpp#l107