64 if( &rhs ==
this )
return *
this;
75 inline void set(
float const *
const ptr)
81 inline void set(
double const *
const ptr)
97 return _mat[0][0]==1.0f &&
_mat[0][1]==0.0f &&
_mat[0][2]==0.0f &&
_mat[0][3]==0.0f &&
98 _mat[1][0]==0.0f &&
_mat[1][1]==1.0f &&
_mat[1][2]==0.0f &&
_mat[1][3]==0.0f &&
99 _mat[2][0]==0.0f &&
_mat[2][1]==0.0f &&
_mat[2][2]==1.0f &&
_mat[2][3]==0.0f &&
100 _mat[3][0]==0.0f &&
_mat[3][1]==0.0f &&
_mat[3][2]==0.0f &&
_mat[3][3]==1.0f;
144 double bottom,
double top,
145 double zNear,
double zFar);
152 double& bottom,
double& top,
153 double& zNear,
double& zFar)
const;
157 float& bottom,
float& top,
158 float& zNear,
float& zFar)
const;
165 double bottom,
double top)
167 makeOrtho(left,right,bottom,top,-1.0,1.0);
175 double bottom,
double top,
176 double zNear,
double zFar);
183 double& bottom,
double& top,
184 double& zNear,
double& zFar)
const;
188 float& bottom,
float& top,
189 float& zNear,
float& zFar)
const;
196 double zNear,
double zFar);
209 double& zNear,
double& zFar)
const;
213 float& zNear,
float& zFar)
const;
235 bool is_4x3 = (rhs.
_mat[0][3]==0.0f && rhs.
_mat[1][3]==0.0f && rhs.
_mat[2][3]==0.0f && rhs.
_mat[3][3]==1.0f);
281 double bottom,
double top,
282 double zNear,
double zFar);
288 double bottom,
double top);
294 double bottom,
double top,
295 double zNear,
double zFar);
302 double zNear,
double zFar);
322 inline Vec3f operator* (
const Vec3f& v )
const;
323 inline Vec3d operator* (
const Vec3d& v )
const;
328 inline Vec4f operator* (
const Vec4f& v )
const;
329 inline Vec4d operator* (
const Vec4d& v )
const;
331#ifdef OSG_USE_DEPRECATED_API
333 inline void get(
Quat& q)
const { q = getRotate(); }
393 inline void operator *= (
const Matrixf& other )
394 {
if(
this == &other ) {
540 a30, a31, a32, a33) {}
546 virtual const char*
className()
const {
return "Matrix"; }
624 m.
makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
632 m.
makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
663 double bottom,
double top,
664 double zNear,
double zFar)
667 m.
makeOrtho(left,right,bottom,top,zNear,zFar);
672 double bottom,
double top)
680 double bottom,
double top,
681 double zNear,
double zFar)
689 double zNear,
double zFar)
797 for (
unsigned i = 0; i < 3; ++i)
811 for (
unsigned i = 0; i < 3; ++i)
825 for (
unsigned i = 0; i < 3; ++i)
839 for (
unsigned i = 0; i < 3; ++i)
853 _mat[0][0] *= v[0];
_mat[0][1] *= v[0];
_mat[0][2] *= v[0];
_mat[0][3] *= v[0];
854 _mat[1][0] *= v[1];
_mat[1][1] *= v[1];
_mat[1][2] *= v[1];
_mat[1][3] *= v[1];
855 _mat[2][0] *= v[2];
_mat[2][1] *= v[2];
_mat[2][2] *= v[2];
_mat[2][3] *= v[2];
860 _mat[0][0] *= v[0];
_mat[0][1] *= v[0];
_mat[0][2] *= v[0];
_mat[0][3] *= v[0];
861 _mat[1][0] *= v[1];
_mat[1][1] *= v[1];
_mat[1][2] *= v[1];
_mat[1][3] *= v[1];
862 _mat[2][0] *= v[2];
_mat[2][1] *= v[2];
_mat[2][2] *= v[2];
_mat[2][3] *= v[2];
867 _mat[0][0] *= v[0];
_mat[1][0] *= v[0];
_mat[2][0] *= v[0];
_mat[3][0] *= v[0];
868 _mat[0][1] *= v[1];
_mat[1][1] *= v[1];
_mat[2][1] *= v[1];
_mat[3][1] *= v[1];
869 _mat[0][2] *= v[2];
_mat[1][2] *= v[2];
_mat[2][2] *= v[2];
_mat[3][2] *= v[2];
874 _mat[0][0] *= v[0];
_mat[1][0] *= v[0];
_mat[2][0] *= v[0];
_mat[3][0] *= v[0];
875 _mat[0][1] *= v[1];
_mat[1][1] *= v[1];
_mat[2][1] *= v[1];
_mat[3][1] *= v[1];
876 _mat[0][2] *= v[2];
_mat[1][2] *= v[2];
_mat[2][2] *= v[2];
_mat[3][2] *= v[2];
The core osg library provides the basic scene graph classes such as Nodes, State and Drawables,...
Definition AlphaFunc:19
Vec3f operator*(const Vec3f &v, const Matrixd &m)
Definition Matrixd:793
T * get(unsigned int contextID)
Definition ContextData:152
bool isNaN(float v)
Definition Math:133
Copy Op(erator) used to control whether shallow or deep copy is used during copy construction and clo...
Definition CopyOp:41
void setTrans(const Vec3d &v)
Matrixf(const Matrixd &mat)
void postMultTranslate(const Vec3d &v)
Optimized version of postMult(translate(v));.
Definition Matrixf:823
Quat getRotate() const
Get the matrix rotation as a Quat.
static Matrixf perspective(double fovy, double aspectRatio, double zNear, double zFar)
Create a symmetrical perspective projection.
Definition Matrixf:688
void mult(const Matrixf &, const Matrixf &)
static Matrixf identity(void)
Definition Matrixf:556
Matrixf(value_type a00, value_type a01, value_type a02, value_type a03, value_type a10, value_type a11, value_type a12, value_type a13, value_type a20, value_type a21, value_type a22, value_type a23, value_type a30, value_type a31, value_type a32, value_type a33)
void preMultScale(const Vec3d &v)
Optimized version of preMult(scale(v));.
Definition Matrixf:851
bool isNaN() const
Definition Matrixf:57
static Matrixf lookAt(const Vec3f &eye, const Vec3f ¢er, const Vec3f &up)
Create the position and orientation as per a camera, using the same convention as gluLookAt.
Definition Matrixf:696
static Vec3f transform3x3(const Vec3f &v, const Matrixf &m)
apply a 3x3 transform of v*M[0..2,0..2].
Definition Matrixf:769
bool invert(const Matrixf &rhs)
invert the matrix rhs, automatically select invert_4x3 or invert_4x4.
Definition Matrixf:233
void makeRotate(const Vec3d &from, const Vec3d &to)
Vec3d getScale() const
Definition Matrixf:350
static Matrixf ortho(double left, double right, double bottom, double top, double zNear, double zFar)
Create an orthographic projection matrix.
Definition Matrixf:662
bool getPerspective(double &fovy, double &aspectRatio, double &zNear, double &zFar) const
Get the frustum settings of a symmetric perspective projection matrix.
float value_type
Definition Matrixf:30
static Matrixf scale(const Vec3f &sv)
Definition Matrixf:570
static Matrixf inverse(const Matrixf &matrix)
Definition Matrixf:648
void makeScale(const Vec3f &)
value_type & operator()(int row, int col)
Definition Matrixf:53
const value_type * ptr() const
Definition Matrixf:93
bool invert_4x4(const Matrixf &rhs)
full 4x4 matrix invert.
void makeRotate(value_type angle1, const Vec3d &axis1, value_type angle2, const Vec3d &axis2, value_type angle3, const Vec3d &axis3)
void set(const Matrixf &rhs)
Definition Matrixf:71
void makePerspective(double fovy, double aspectRatio, double zNear, double zFar)
Set to a symmetrical perspective projection.
void orthoNormalize(const Matrixf &rhs)
ortho-normalize the 3x3 rotation & scale matrix
bool invert_4x3(const Matrixf &rhs)
4x3 matrix invert, not right hand column is assumed to be 0,0,0,1.
void decompose(osg::Vec3f &translation, osg::Quat &rotation, osg::Vec3f &scale, osg::Quat &so) const
decompose the matrix into translation, rotation, scale and scale orientation.
void preMultTranslate(const Vec3d &v)
Optimized version of preMult(translate(v));.
Definition Matrixf:795
void makeRotate(value_type angle, value_type x, value_type y, value_type z)
static Matrixf translate(const Vec3f &dv)
Definition Matrixf:587
void makeScale(const Vec3d &)
Vec3f postMult(const Vec3f &v) const
Definition Matrixf:710
void setRotate(const Quat &q)
Matrixf(const Matrixf &mat)
Definition Matrixf:34
int compare(const Matrixf &m) const
void set(const Matrixd &rhs)
static Matrixf orthoNormal(const Matrixf &matrix)
Definition Matrixf:655
value_type operator()(int row, int col) const
Definition Matrixf:54
bool getFrustum(double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
Get the frustum settings of a perspective projection matrix.
void setTrans(const Vec3f &v)
bool transpose3x3(const Matrixf &rhs)
transpose orthogonal part of the matrix
void set(float const *const ptr)
Definition Matrixf:75
void preMultRotate(const Quat &q)
Optimized version of preMult(rotate(q));.
Definition Matrixf:880
void makeRotate(const Vec3f &from, const Vec3f &to)
void set(double const *const ptr)
Definition Matrixf:81
bool valid() const
Definition Matrixf:56
value_type * ptr()
Definition Matrixf:92
void set(value_type a00, value_type a01, value_type a02, value_type a03, value_type a10, value_type a11, value_type a12, value_type a13, value_type a20, value_type a21, value_type a22, value_type a23, value_type a30, value_type a31, value_type a32, value_type a33)
void makeScale(value_type, value_type, value_type)
void makeRotate(value_type angle1, const Vec3f &axis1, value_type angle2, const Vec3f &axis2, value_type angle3, const Vec3f &axis3)
Vec3f operator*(const Vec3f &v) const
Definition Matrixf:915
static Matrixf rotate(const Vec3f &from, const Vec3f &to)
Definition Matrixf:635
void decompose(osg::Vec3d &translation, osg::Quat &rotation, osg::Vec3d &scale, osg::Quat &so) const
decompose the matrix into translation, rotation, scale and scale orientation.
void postMultRotate(const Quat &q)
Optimized version of postMult(rotate(q));.
Definition Matrixf:889
void getLookAt(Vec3d &eye, Vec3d ¢er, Vec3d &up, value_type lookDistance=1.0f) const
Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt.
void makeTranslate(const Vec3f &)
~Matrixf()
Definition Matrixf:45
void preMult(const Matrixf &)
value_type _mat[4][4]
Definition Matrixf:519
bool getOrtho(double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
Get the orthographic settings of the orthographic projection matrix.
static Matrixf frustum(double left, double right, double bottom, double top, double zNear, double zFar)
Create a perspective projection.
Definition Matrixf:679
Vec3f preMult(const Vec3f &v) const
Definition Matrixf:725
Matrixf(float const *const ptr)
Definition Matrixf:36
bool transpose(const Matrixf &rhs)
transpose matrix
Vec3d getTrans() const
Definition Matrixf:348
void makeLookAt(const Vec3d &eye, const Vec3d ¢er, const Vec3d &up)
Set the position and orientation to be a view matrix, using the same convention as gluLookAt.
Matrixf()
Definition Matrixf:33
void postMult(const Matrixf &)
void makeTranslate(value_type, value_type, value_type)
bool getOrtho(float &left, float &right, float &bottom, float &top, float &zNear, float &zFar) const
float version of getOrtho(..)
void makeOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
Set to an orthographic projection.
void getLookAt(Vec3f &eye, Vec3f ¢er, Vec3f &up, value_type lookDistance=1.0f) const
Get to the position and orientation of a modelview matrix, using the same convention as gluLookAt.
void postMultScale(const Vec3d &v)
Optimized version of postMult(scale(v));.
Definition Matrixf:865
Matrixf(const Quat &quat)
Definition Matrixf:38
Matrixf(double const *const ptr)
Definition Matrixf:37
bool isIdentity() const
Definition Matrixf:95
void makeRotate(const Quat &)
void makeOrtho2D(double left, double right, double bottom, double top)
Set to a 2D orthographic projection.
Definition Matrixf:164
void makeFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
Set to a perspective projection.
bool getFrustum(float &left, float &right, float &bottom, float &top, float &zNear, float &zFar) const
float version of getFrustum(..)
void setTrans(value_type tx, value_type ty, value_type tz)
void makeTranslate(const Vec3d &)
static Matrixf ortho2D(double left, double right, double bottom, double top)
Create a 2D orthographic projection.
Definition Matrixf:671
void makeRotate(value_type angle, const Vec3d &axis)
bool getPerspective(float &fovy, float &aspectRatio, float &zNear, float &zFar) const
float version of getPerspective(..)
void makeRotate(value_type angle, const Vec3f &axis)
double other_value_type
Definition Matrixf:31
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition Matrixf:542
virtual const char * className() const
return the name of the object's class type.
Definition Matrixf:546
virtual ~RefMatrixf()
Definition Matrixf:551
virtual Object * clone(const CopyOp &) const
Clone an object, with Object* return type.
Definition Matrixf:543
RefMatrixf(Matrixf::value_type const *const def)
Definition Matrixf:531
RefMatrixf()
Definition Matrixf:527
RefMatrixf(Matrixf::value_type a00, Matrixf::value_type a01, Matrixf::value_type a02, Matrixf::value_type a03, Matrixf::value_type a10, Matrixf::value_type a11, Matrixf::value_type a12, Matrixf::value_type a13, Matrixf::value_type a20, Matrixf::value_type a21, Matrixf::value_type a22, Matrixf::value_type a23, Matrixf::value_type a30, Matrixf::value_type a31, Matrixf::value_type a32, Matrixf::value_type a33)
Definition Matrixf:532
RefMatrixf(const Matrixd &other)
Definition Matrixf:529
RefMatrixf(const RefMatrixf &other)
Definition Matrixf:530
virtual const char * libraryName() const
return the name of the object's library.
Definition Matrixf:545
virtual bool isSameKindAs(const Object *obj) const
Definition Matrixf:544
RefMatrixf(const Matrixf &other)
Definition Matrixf:528
Object()
Construct an object.
Definition Object:69
A quaternion class.
Definition Quat:30
bool zeroRotation() const
return true if the Quat represents a zero rotation, and therefore can be ignored in computations.
Definition Quat:173
General purpose double triple for use as vertices, vectors and normals.
Definition Vec3d:30
value_type & z()
Definition Vec3d:87
value_type & x()
Definition Vec3d:85
value_type & y()
Definition Vec3d:86
value_type length() const
Length of the vector = sqrt( vec .
Definition Vec3d:181
General purpose float triple for use as vertices, vectors and normals.
Definition Vec3f:29
value_type & z()
Definition Vec3f:82
value_type & y()
Definition Vec3f:81
value_type & x()
Definition Vec3f:80
General purpose double quad.
Definition Vec4d:29
value_type & x()
Definition Vec4d:90
value_type & y()
Definition Vec4d:91
value_type & z()
Definition Vec4d:92
value_type & w()
Definition Vec4d:93
General purpose float quad.
Definition Vec4f:28
value_type & y()
Definition Vec4f:88
value_type & x()
Definition Vec4f:87
value_type & z()
Definition Vec4f:89
value_type & w()
Definition Vec4f:90
#define NULL
Definition Export:55
#define OSG_EXPORT
Definition Export:39