OpenSceneGraph icon indicating copy to clipboard operation
OpenSceneGraph copied to clipboard

Should naming be exchanged?

Open dansirming opened this issue 1 year ago • 1 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?

dansirming avatar Apr 30 '23 03:04 dansirming

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

robertosfield avatar Apr 30 '23 10:04 robertosfield