Text archives Help
- From: sparker@sci.utah.edu
- To: manta@sci.utah.edu
- Subject: [Manta] r1952 - trunk/Core/Geometry
- Date: Sun, 30 Dec 2007 23:33:56 -0700 (MST)
Author: sparker
Date: Sun Dec 30 23:33:55 2007
New Revision: 1952
Modified:
trunk/Core/Geometry/AffineTransform.cc
trunk/Core/Geometry/AffineTransform.h
Log:
Added method to detect an identity matrix
Modified: trunk/Core/Geometry/AffineTransform.cc
==============================================================================
--- trunk/Core/Geometry/AffineTransform.cc (original)
+++ trunk/Core/Geometry/AffineTransform.cc Sun Dec 30 23:33:55 2007
@@ -45,6 +45,19 @@
}
}
+ bool AffineTransform::isIdentity() const
+ {
+ for(int row = 0; row < 3; row++){
+ if(mat[row][row] != 1)
+ return false;
+ for(int col = 0; col < 4; col++){
+ if(row != col && mat[row][col] != 0)
+ return false;
+ }
+ }
+ return true;
+ }
+
void AffineTransform::initWithScale(const Vector& s)
{
initWithIdentity();
Modified: trunk/Core/Geometry/AffineTransform.h
==============================================================================
--- trunk/Core/Geometry/AffineTransform.h (original)
+++ trunk/Core/Geometry/AffineTransform.h Sun Dec 30 23:33:55 2007
@@ -93,9 +93,14 @@
// Other methods
AffineTransform inverse() const;
void invert();
+ bool isIdentity() const;
// Const Accessors used by global multiplication operators.
const Real &operator() (unsigned int r, unsigned int c) const {
+ return mat[r][c];
+ }
+ // Accessors used by global multiplication operators.
+ Real &operator() (unsigned int r, unsigned int c) {
return mat[r][c];
}
- [Manta] r1952 - trunk/Core/Geometry, sparker, 12/31/2007
Archive powered by MHonArc 2.6.16.