[MOAB-dev] r4472 - MOAB/trunk/src

kraftche at cae.wisc.edu kraftche at cae.wisc.edu
Wed Jan 26 14:35:49 CST 2011


Author: kraftche
Date: 2011-01-26 14:35:48 -0600 (Wed, 26 Jan 2011)
New Revision: 4472

Modified:
   MOAB/trunk/src/AffineXform.cpp
   MOAB/trunk/src/AffineXform.hpp
Log:
fix bug in AffineXform && add regression test

Modified: MOAB/trunk/src/AffineXform.cpp
===================================================================
--- MOAB/trunk/src/AffineXform.cpp	2011-01-25 21:09:54 UTC (rev 4471)
+++ MOAB/trunk/src/AffineXform.cpp	2011-01-26 20:35:48 UTC (rev 4472)
@@ -358,8 +358,14 @@
 {
   CartVect output;
   
+  AffineXform scale = AffineXform::scale( 1.0 );
+  ASSERT(!scale.scale());
+  scale = AffineXform::scale( -1.0 );
+  ASSERT(!scale.scale());
+  
   //scale in X only
-  AffineXform scale = AffineXform::scale( CartVect(2,1,1).array() );
+  scale = AffineXform::scale( CartVect(2,1,1).array() );
+  ASSERT(scale.scale());
   scale.xform_point( point1.array(), output.array() );
   ASSERT_VECTORS_EQUAL( output, CartVect(2*point1[0],point1[1],point1[2]) );
   scale.xform_point( point2.array(), output.array() );
@@ -371,6 +377,7 @@
   
   // scale in all
   scale = AffineXform::scale( CartVect(0.5,0.5,0.5).array() );
+  ASSERT(scale.scale());
   scale.xform_point( point1.array(), output.array() );
   ASSERT_VECTORS_EQUAL( output, 0.5*point1 );
   scale.xform_point( point2.array(), output.array() );

Modified: MOAB/trunk/src/AffineXform.hpp
===================================================================
--- MOAB/trunk/src/AffineXform.hpp	2011-01-25 21:09:54 UTC (rev 4471)
+++ MOAB/trunk/src/AffineXform.hpp	2011-01-26 20:35:48 UTC (rev 4472)
@@ -243,7 +243,7 @@
 
 inline bool AffineXform::scale() const
 {
-  return fabs(fabs(mMatrix.determinant()) - 1) < std::numeric_limits<double>::epsilon();
+  return fabs(fabs(mMatrix.determinant()) - 1) > std::numeric_limits<double>::epsilon();
 }
   
 } // namespace moab











More information about the moab-dev mailing list