Commit 9e179c2a authored by Alexis Girault's avatar Alexis Girault

Add vtkMatrix4x4::IsIdentity() method

parent 0a467f5b
......@@ -87,6 +87,11 @@ public:
{ vtkMatrix4x4::Identity(*this->Element); this->Modified();}
static void Identity(double elements[16]);
/**
* Returns true if this matrix is equal to the identity matrix.
*/
bool IsIdentity();
/**
* Matrix Inversion (adapted from Richard Carling in "Graphics Gems,"
* Academic Press, 1990).
......@@ -228,5 +233,16 @@ inline void vtkMatrix4x4::SetElement(int i, int j, double value)
}
}
//----------------------------------------------------------------------------
inline bool vtkMatrix4x4::IsIdentity()
{
double *M = *this->Element;
return
M[0] == 1.0 && M[1] == 0.0 && M[2] == 0.0 && M[3] == 0.0 &&
M[4] == 0.0 && M[5] == 1.0 && M[6] == 0.0 && M[7] == 0.0 &&
M[8] == 0.0 && M[9] == 0.0 && M[10] == 1.0 && M[11] == 0.0 &&
M[12] == 0.0 && M[13] == 0.0 && M[14] == 0.0 && M[15] == 1.0;
}
#endif
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment