Added set and get methods for Matrixd and Matrixf.
This commit is contained in:
@@ -20,6 +20,9 @@
|
||||
|
||||
namespace osg {
|
||||
|
||||
class Matrixf;
|
||||
class Matrixd;
|
||||
|
||||
/** A quaternion class. It can be used to represent an orientation in 3D space.*/
|
||||
class SG_EXPORT Quat
|
||||
{
|
||||
@@ -87,6 +90,15 @@ class SG_EXPORT Quat
|
||||
{
|
||||
_fv = v;
|
||||
}
|
||||
|
||||
void set(const Matrixf& matrix);
|
||||
|
||||
void set(const Matrixd& matrix);
|
||||
|
||||
void get(Matrixf& matrix) const;
|
||||
|
||||
void get(Matrixd& matrix) const;
|
||||
|
||||
|
||||
inline float& operator [] (int i) { return _fv[i]; }
|
||||
inline float operator [] (int i) const { return _fv[i]; }
|
||||
|
||||
@@ -14,6 +14,8 @@
|
||||
#include <osg/Quat>
|
||||
#include <osg/Vec4>
|
||||
#include <osg/Vec3>
|
||||
#include <osg/Matrixf>
|
||||
#include <osg/Matrixd>
|
||||
|
||||
#include <math.h>
|
||||
|
||||
@@ -24,6 +26,27 @@
|
||||
using namespace osg;
|
||||
|
||||
|
||||
void Quat::set(const Matrixf& matrix)
|
||||
{
|
||||
matrix.get(*this);
|
||||
}
|
||||
|
||||
void Quat::set(const Matrixd& matrix)
|
||||
{
|
||||
matrix.get(*this);
|
||||
}
|
||||
|
||||
void Quat::get(Matrixf& matrix) const
|
||||
{
|
||||
matrix.set(*this);
|
||||
}
|
||||
|
||||
void Quat::get(Matrixd& matrix) const
|
||||
{
|
||||
matrix.set(*this);
|
||||
}
|
||||
|
||||
|
||||
/// Set the elements of the Quat to represent a rotation of angle
|
||||
/// (radians) around the axis (x,y,z)
|
||||
void Quat::makeRotate( float angle,
|
||||
|
||||
Reference in New Issue
Block a user