use square epsilon in btVector3::fuzzyZero (length2)

This commit is contained in:
erwin.coumans@gmail.com
2013-10-29 22:53:01 +00:00
parent 1a2c3c0ee9
commit 13936eb9a5
2 changed files with 20 additions and 3 deletions

View File

@@ -22,7 +22,7 @@ subject to the following restrictions:
//#define BT_DEBUG_OSTREAM
#ifdef BT_DEBUG_OSTREAM
#include <ostream>
#include <iostream>
#include <iomanip> // std::setw
#endif //BT_DEBUG_OSTREAM
@@ -616,7 +616,7 @@ typedef btVectorX<double> btVectorXd;
#ifdef BT_DEBUG_OSTREAM
template <typename T>
std::ostream& operator<< (std::ostream& os, btMatrixX<T>& mat)
std::ostream& operator<< (std::ostream& os, const btMatrixX<T>& mat)
{
os << " [";
@@ -633,6 +633,23 @@ std::ostream& operator<< (std::ostream& os, btMatrixX<T>& mat)
os << " ]";
//printf("\n---------------------\n");
return os;
}
template <typename T>
std::ostream& operator<< (std::ostream& os, const btVectorX<T>& mat)
{
os << " [";
//printf("%s ---------------------\n",msg);
for (int i=0;i<mat.rows();i++)
{
os << std::setw(10) << mat[i];
if (i!=mat.rows()-1)
os << std::endl << " ";
}
os << " ]";
//printf("\n---------------------\n");
return os;
}

View File

@@ -688,7 +688,7 @@ public:
SIMD_FORCE_INLINE bool fuzzyZero() const
{
return length2() < SIMD_EPSILON;
return length2() < SIMD_EPSILON*SIMD_EPSILON;
}
SIMD_FORCE_INLINE void serialize(struct btVector3Data& dataOut) const;