Main Page | Namespace List | Class Hierarchy | Alphabetical List | Class List | Directories | Namespace Members | Class Members

KeepUpAttitudeCorrection Class Reference

#include <src/KeepUpAttitudeCorrection.h>

Inheritance diagram for KeepUpAttitudeCorrection:

Inheritance graph
[legend]
Collaboration diagram for KeepUpAttitudeCorrection:

Collaboration graph
[legend]
List of all members.

Detailed Description

When mapping old direction to the new one, the rotation around the new direction is made so the up vector lies in the plane of the target up vector.

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.

Author:
Nicolas Brodu


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


Constructor & Destructor Documentation

KeepUpAttitudeCorrection::KeepUpAttitudeCorrection const osg::Vec3d &  targetUpVector,
const osg::Vec3d &  initUp
 

In addition to the target up vector, the initial up vector must be provided.

The matchTarget function also needs a current Up vector.


Member Function Documentation

void KeepUpAttitudeCorrection::matchTarget osg::Quat &  newAttitude,
osg::Vec3d &  newForward
[virtual]
 

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.

void KeepUpAttitudeCorrection::set const osg::Vec3d &  targetUpVector,
const osg::Vec3d &  initUp
[virtual]
 

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.


Member Data Documentation

osg::Vec3d KeepUpAttitudeCorrection::targetUp
 

The target Up vector.

See the class description.

See also:
matchTarget


The documentation for this class was generated from the following files:
Generated on Mon Mar 28 11:27:21 2005 for Crogai by  doxygen 1.4.1