From 33782a51776fb75980f7c6e9db2e412367f2c17e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Wed, 10 Dec 2008 10:10:45 +0000 Subject: [PATCH] From Marcin Prus, "some time ago there was an optimization fix including change in DirectionalSector::computeMatrix(). Rotation matrices were replaced with quaternions but incorrect contructor was used. There was a call to Quat(angle, xAxis, yAxis, zAxis ) but there is no such constructor in Quat class to create quaternion for rotation. As a result we got this values being written into quaternion directly. I've replaced Quat contructor calls with the ones creating rotation quaternions Quat( angle, Vec3( axis ) )." --- src/osgSim/Sector.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/osgSim/Sector.cpp b/src/osgSim/Sector.cpp index ef3e9733b..580619158 100644 --- a/src/osgSim/Sector.cpp +++ b/src/osgSim/Sector.cpp @@ -234,9 +234,9 @@ void DirectionalSector::computeMatrix() double pitch = atan2(_direction[2], sqrt(_direction[0]*_direction[0] + _direction[1]*_direction[1])); double roll = _rollAngle; - _local_to_LP.setRotate(osg::Quat(heading, 0.0, 0.0, -1.0)); - _local_to_LP.preMultRotate(osg::Quat(pitch, 1.0, 0.0, 0.0)); - _local_to_LP.preMultRotate(osg::Quat(roll, 0.0, 1.0, 0.0)); + _local_to_LP.setRotate(osg::Quat(heading,osg::Vec3d(0.0, 0.0, -1.0))); + _local_to_LP.preMultRotate(osg::Quat(pitch, osg::Vec3d(1.0, 0.0, 0.0))); + _local_to_LP.preMultRotate(osg::Quat(roll, osg::Vec3d(0.0, 1.0, 0.0))); } void DirectionalSector::setDirection(const osg::Vec3& direction)