opensurgsim
Namespaces | Functions
OsgQuaternionConversions.h File Reference

Conversions to and from OSG quaternion types. More...

#include "SurgSim/Math/Quaternion.h"
#include <osg/Quat>

Go to the source code of this file.

Namespaces

 SurgSim
 Wraps glewInit() to separate the glew opengl definitions from the osg opengl definitions only imgui needs glew but we need to call glewInit() from a osg callback, using this call we avoid getting warnings about redefinitions.
 

Functions

osg::Quat SurgSim::Graphics::toOsg (const SurgSim::Math::Quaternionf &quaternion)
 Convert quaternion of floats to OSG.
 
osg::Quat SurgSim::Graphics::toOsg (const SurgSim::Math::Quaterniond &quaternion)
 Convert quaternion of doubles to OSG.
 
template<typename T >
Eigen::Quaternion< T > SurgSim::Graphics::fromOsg (const osg::Quat &quaternion)
 Convert from OSG to either quaternion of floats or doubles. More...
 

Detailed Description

Conversions to and from OSG quaternion types.

Note that the Eigen quaternion constructor takes the W component first, while OSG stores it last.

Also note that OSG only has one Quat type, which uses double for the value type. Conversions are provided to and from this type for both SurgSim::Math::Quaternionf and SurgSim::Math::Quaterniond.

Function Documentation

§ fromOsg()

template<typename T >
Eigen::Quaternion<T> SurgSim::Graphics::fromOsg ( const osg::Quat &  quaternion)
inline

Convert from OSG to either quaternion of floats or doubles.

Template Parameters
TValue type (float or double)