#include <src/KeepUpAttitudeCorrection.h>
Inheritance diagram for KeepUpAttitudeCorrection:
Alternatively, a function is provided to force the up vector to match perfectly the target vector, which is not the same, as it modifies the forward vector.
No costly acos or sin are used, the quaternion is found only with fast geometrical properties. See for example http://logiciels.cnes.fr/MARMOTTES/marmottes-mathematique.pdf for an explanation of the math used.
Care is taken for reconditionning the quaternion after too many rotations, when this becomes necessary.
Public Member Functions | |
KeepUpAttitudeCorrection (const osg::Vec3d &targetUpVector, const osg::Vec3d &initUp) | |
In addition to the target up vector, the initial up vector must be provided. | |
virtual void | set (const osg::Vec3d &targetUpVector, const osg::Vec3d &initUp) |
Avoid building a new object when we can re-use an existing one. | |
const osg::Vec3d & | getUpVector () const |
read-only accessor => use matchTarget or set to change | |
virtual void | updateAttitude (osg::Quat &newAttitude, const osg::Quat &oldAttitude, const osg::Vec3d &newForward, const osg::Vec3d &oldForward) |
See class descrition. | |
virtual void | matchTarget (osg::Quat &newAttitude, osg::Vec3d &newForward) |
Force the up vector to match perfectly the target vector, and modify the forward direction accordingly. | |
Public Attributes | |
osg::Vec3d | targetUp |
The target Up vector. | |
Protected Attributes | |
osg::Quat | qpassage |
osg::Vec3d | newUp |
osg::Vec3d | oldUp |
|
In addition to the target up vector, the initial up vector must be provided. The matchTarget function also needs a current Up vector. |
|
Force the up vector to match perfectly the target vector, and modify the forward direction accordingly. The mapping from Up to targetUp is done using shortest-angle quaternion rotation. |
|
Avoid building a new object when we can re-use an existing one. Equivalent to operator= In addition to the target up vector, the initial up vector must be provided. The matchTarget function also needs a current Up vector. |
|
The target Up vector. See the class description.
|