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.0 &&
_mat[0][1]==0.0 &&
_mat[0][2]==0.0 &&
_mat[0][3]==0.0 &&
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.0 && rhs.
_mat[1][3]==0.0 && rhs.
_mat[2][3]==0.0 && rhs.
_mat[3][3]==1.0);
280 double bottom,
double top,
281 double zNear,
double zFar);
287 double bottom,
double top);
293 double bottom,
double top,
294 double zNear,
double zFar);
301 double zNear,
double zFar);
321 inline Vec3f operator* (
const Vec3f& v )
const;
322 inline Vec3d operator* (
const Vec3d& v )
const;
327 inline Vec4f operator* (
const Vec4f& v )
const;
328 inline Vec4d operator* (
const Vec4d& v )
const;
330#ifdef OSG_USE_DEPRECATED_API
332 inline void get(
Quat& q)
const { q = getRotate(); }
391 inline void operator *= (
const Matrixd& other )
392 {
if(
this == &other ) {
428 a30, a31, a32, a33) {}
434 virtual const char*
className()
const {
return "Matrix"; }
512 m.
makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
520 m.
makeRotate(angle1,axis1,angle2,axis2,angle3,axis3);
551 double bottom,
double top,
552 double zNear,
double zFar)
555 m.
makeOrtho(left,right,bottom,top,zNear,zFar);
560 double bottom,
double top)
568 double bottom,
double top,
569 double zNear,
double zFar)
577 double zNear,
double zFar)
693 for (
unsigned i = 0; i < 3; ++i)
707 for (
unsigned i = 0; i < 3; ++i)
721 for (
unsigned i = 0; i < 3; ++i)
735 for (
unsigned i = 0; i < 3; ++i)
749 _mat[0][0] *= v[0];
_mat[0][1] *= v[0];
_mat[0][2] *= v[0];
_mat[0][3] *= v[0];
750 _mat[1][0] *= v[1];
_mat[1][1] *= v[1];
_mat[1][2] *= v[1];
_mat[1][3] *= v[1];
751 _mat[2][0] *= v[2];
_mat[2][1] *= v[2];
_mat[2][2] *= v[2];
_mat[2][3] *= v[2];
756 _mat[0][0] *= v[0];
_mat[0][1] *= v[0];
_mat[0][2] *= v[0];
_mat[0][3] *= v[0];
757 _mat[1][0] *= v[1];
_mat[1][1] *= v[1];
_mat[1][2] *= v[1];
_mat[1][3] *= v[1];
758 _mat[2][0] *= v[2];
_mat[2][1] *= v[2];
_mat[2][2] *= v[2];
_mat[2][3] *= v[2];
763 _mat[0][0] *= v[0];
_mat[1][0] *= v[0];
_mat[2][0] *= v[0];
_mat[3][0] *= v[0];
764 _mat[0][1] *= v[1];
_mat[1][1] *= v[1];
_mat[2][1] *= v[1];
_mat[3][1] *= v[1];
765 _mat[0][2] *= v[2];
_mat[1][2] *= v[2];
_mat[2][2] *= v[2];
_mat[3][2] *= v[2];
770 _mat[0][0] *= v[0];
_mat[1][0] *= v[0];
_mat[2][0] *= v[0];
_mat[3][0] *= v[0];
771 _mat[0][1] *= v[1];
_mat[1][1] *= v[1];
_mat[2][1] *= v[1];
_mat[3][1] *= v[1];
772 _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 makeRotate(value_type angle, const Vec3d &axis)
Matrixd(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)
float other_value_type
Definition Matrixd:31
void setRotate(const Quat &q)
Vec3d getScale() const
Definition Matrixd:348
~Matrixd()
Definition Matrixd:45
static Vec3f transform3x3(const Vec3f &v, const Matrixd &m)
apply a 3x3 transform of v*M[0..2,0..2].
Definition Matrixd:665
static Matrixd ortho2D(double left, double right, double bottom, double top)
Create a 2D orthographic projection.
Definition Matrixd:559
void postMultRotate(const Quat &q)
Optimized version of postMult(rotate(q));.
Definition Matrixd:784
bool isIdentity() const
Definition Matrixd:95
void makeRotate(const Vec3d &from, const Vec3d &to)
void set(const Matrixd &rhs)
Definition Matrixd:71
void setTrans(value_type tx, value_type ty, value_type tz)
void makeTranslate(value_type, value_type, value_type)
void preMultScale(const Vec3d &v)
Optimized version of preMult(scale(v));.
Definition Matrixd:747
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.
value_type _mat[4][4]
Definition Matrixd:407
Quat getRotate() const
Get the matrix rotation as a Quat.
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 makeRotate(value_type angle, const Vec3f &axis)
bool getOrtho(float &left, float &right, float &bottom, float &top, float &zNear, float &zFar) const
float version of getOrtho(..)
static Matrixd orthoNormal(const Matrixd &matrix)
Definition Matrixd:543
void setTrans(const Vec3f &v)
void postMultScale(const Vec3d &v)
Optimized version of postMult(scale(v));.
Definition Matrixd:761
Matrixd(const Matrixd &mat)
Definition Matrixd:34
Matrixd(const Matrixf &mat)
Matrixd()
Definition Matrixd:33
bool getPerspective(double &fovy, double &aspectRatio, double &zNear, double &zFar) const
Get the frustum settings of a symmetric perspective projection matrix.
bool invert_4x4(const Matrixd &rhs)
full 4x4 matrix invert.
static Matrixd frustum(double left, double right, double bottom, double top, double zNear, double zFar)
Create a perspective projection.
Definition Matrixd:567
void makeRotate(const Quat &)
void makeScale(const Vec3d &)
void makeScale(value_type, value_type, value_type)
value_type * ptr()
Definition Matrixd:92
bool transpose(const Matrixd &rhs)
transpose a matrix
void setTrans(const Vec3d &v)
Matrixd(float const *const ptr)
Definition Matrixd:36
static Matrixd 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 Matrixd:584
static Matrixd ortho(double left, double right, double bottom, double top, double zNear, double zFar)
Create an orthographic projection matrix.
Definition Matrixd:550
void makeFrustum(double left, double right, double bottom, double top, double zNear, double zFar)
Set to a perspective projection.
Matrixd(const Quat &quat)
Definition Matrixd:38
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 orthoNormalize(const Matrixd &rhs)
ortho-normalize the 3x3 rotation & scale matrix
Matrixd(double const *const ptr)
Definition Matrixd:37
int compare(const Matrixd &m) const
void preMultTranslate(const Vec3d &v)
Optimized version of preMult(translate(v));.
Definition Matrixd:691
void makeRotate(value_type angle1, const Vec3d &axis1, value_type angle2, const Vec3d &axis2, value_type angle3, const Vec3d &axis3)
const value_type * ptr() const
Definition Matrixd:93
Vec3f operator*(const Vec3f &v) const
Definition Matrixd:813
Vec3f preMult(const Vec3f &v) const
Definition Matrixd:618
void makeRotate(value_type angle, value_type x, value_type y, value_type z)
value_type operator()(int row, int col) const
Definition Matrixd:54
static Matrixd scale(const Vec3f &sv)
Definition Matrixd:458
bool valid() const
Definition Matrixd:56
static Matrixd perspective(double fovy, double aspectRatio, double zNear, double zFar)
Create a symmetrical perspective projection.
Definition Matrixd:576
void makeTranslate(const Vec3f &)
void set(float const *const ptr)
Definition Matrixd:75
void postMult(const Matrixd &)
Vec3d getTrans() const
Definition Matrixd:346
void makeOrtho(double left, double right, double bottom, double top, double zNear, double zFar)
Set to an orthographic projection.
static Matrixd rotate(const Vec3f &from, const Vec3f &to)
Definition Matrixd:523
void makeScale(const Vec3f &)
static Matrixd inverse(const Matrixd &matrix)
Definition Matrixd:536
Vec3f postMult(const Vec3f &v) const
Definition Matrixd:602
value_type & operator()(int row, int col)
Definition Matrixd:53
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 set(const Matrixf &rhs)
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.
bool getOrtho(double &left, double &right, double &bottom, double &top, double &zNear, double &zFar) const
Get the orthographic settings of the orthographic projection matrix.
void makeOrtho2D(double left, double right, double bottom, double top)
Set to a 2D orthographic projection.
Definition Matrixd:164
bool invert_4x3(const Matrixd &rhs)
4x3 matrix invert, not right hand column is assumed to be 0,0,0,1.
double value_type
Definition Matrixd:30
void preMultRotate(const Quat &q)
Optimized version of preMult(rotate(q));.
Definition Matrixd:775
static Matrixd translate(const Vec3f &dv)
Definition Matrixd:475
void preMult(const Matrixd &)
void makeTranslate(const Vec3d &)
void makeRotate(value_type angle1, const Vec3f &axis1, value_type angle2, const Vec3f &axis2, value_type angle3, const Vec3f &axis3)
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 makePerspective(double fovy, double aspectRatio, double zNear, double zFar)
Set to a symmetrical perspective projection.
void postMultTranslate(const Vec3d &v)
Optimized version of postMult(translate(v));.
Definition Matrixd:719
void makeRotate(const Vec3f &from, const Vec3f &to)
bool getPerspective(float &fovy, float &aspectRatio, float &zNear, float &zFar) const
float version of getPerspective(..)
bool invert(const Matrixd &rhs)
invert the matrix rhs, automatically select invert_4x3 or invert_4x4.
Definition Matrixd:233
static Matrixd identity(void)
Definition Matrixd:444
bool getFrustum(float &left, float &right, float &bottom, float &top, float &zNear, float &zFar) const
float version of getFrustum(..)
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.
bool isNaN() const
Definition Matrixd:57
void mult(const Matrixd &, const Matrixd &)
void set(double const *const ptr)
Definition Matrixd:81
bool transpose3x3(const Matrixd &rhs)
transpose orthogonal part of the matrix
RefMatrixd(Matrixd::value_type a00, Matrixd::value_type a01, Matrixd::value_type a02, Matrixd::value_type a03, Matrixd::value_type a10, Matrixd::value_type a11, Matrixd::value_type a12, Matrixd::value_type a13, Matrixd::value_type a20, Matrixd::value_type a21, Matrixd::value_type a22, Matrixd::value_type a23, Matrixd::value_type a30, Matrixd::value_type a31, Matrixd::value_type a32, Matrixd::value_type a33)
Definition Matrixd:420
RefMatrixd(const Matrixf &other)
Definition Matrixd:417
virtual bool isSameKindAs(const Object *obj) const
Definition Matrixd:432
RefMatrixd(Matrixd::value_type const *const def)
Definition Matrixd:419
virtual Object * cloneType() const
Clone the type of an object, with Object* return type.
Definition Matrixd:430
RefMatrixd(const RefMatrixd &other)
Definition Matrixd:418
virtual Object * clone(const CopyOp &) const
Clone an object, with Object* return type.
Definition Matrixd:431
RefMatrixd()
Definition Matrixd:415
virtual const char * libraryName() const
return the name of the object's library.
Definition Matrixd:433
virtual ~RefMatrixd()
Definition Matrixd:439
RefMatrixd(const Matrixd &other)
Definition Matrixd:416
virtual const char * className() const
return the name of the object's class type.
Definition Matrixd:434
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