From 2a8c48c13cc781961a0a92a223e6d81f58a4af2e Mon Sep 17 00:00:00 2001 From: Robert Osfield Date: Fri, 24 Nov 2006 21:10:57 +0000 Subject: [PATCH] Added isIdentity() method --- include/osg/Matrixd | 8 ++++++++ include/osg/Matrixf | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/include/osg/Matrixd b/include/osg/Matrixd index 150bf71d1..020140467 100644 --- a/include/osg/Matrixd +++ b/include/osg/Matrixd @@ -93,6 +93,14 @@ class OSG_EXPORT Matrixd void makeIdentity(); + bool isIdentity() const + { + return _mat[0][0]==1.0 && _mat[0][1]==0.0 && _mat[0][2]==0.0 && _mat[0][3]==0.0 && + _mat[1][0]==0.0 && _mat[1][1]==1.0 && _mat[1][2]==0.0 && _mat[1][3]==0.0 && + _mat[2][0]==0.0 && _mat[2][1]==0.0 && _mat[2][2]==1.0 && _mat[2][3]==0.0 && + _mat[3][0]==0.0 && _mat[3][1]==0.0 && _mat[3][2]==0.0 && _mat[3][3]==1.0; + } + void makeScale( const Vec3f& ); void makeScale( const Vec3d& ); void makeScale( value_type, value_type, value_type ); diff --git a/include/osg/Matrixf b/include/osg/Matrixf index cfd340bba..199968168 100644 --- a/include/osg/Matrixf +++ b/include/osg/Matrixf @@ -91,6 +91,14 @@ class OSG_EXPORT Matrixf value_type * ptr() { return (value_type*)_mat; } const value_type * ptr() const { return (const value_type *)_mat; } + bool isIdentity() const + { + return _mat[0][0]==1.0f && _mat[0][1]==0.0f && _mat[0][2]==0.0f && _mat[0][3]==0.0f && + _mat[1][0]==0.0f && _mat[1][1]==1.0f && _mat[1][2]==0.0f && _mat[1][3]==0.0f && + _mat[2][0]==0.0f && _mat[2][1]==0.0f && _mat[2][2]==1.0f && _mat[2][3]==0.0f && + _mat[3][0]==0.0f && _mat[3][1]==0.0f && _mat[3][2]==0.0f && _mat[3][3]==1.0f; + } + void makeIdentity(); void makeScale( const Vec3f& );