Math/Matrix4: Fix computations.

Sometimes some values can be really small (and very close to zero) without being null.


Former-commit-id: 932160043e4eb4094c7234f8cf4eb7c212966678
This commit is contained in:
Lynix 2016-01-15 01:04:29 +01:00
parent f49f77b75d
commit 2cace84c90
1 changed files with 3 additions and 6 deletions

View File

@ -326,7 +326,7 @@ namespace Nz
#endif #endif
T det = GetDeterminant(); T det = GetDeterminant();
if (!NumberEquals(det, F(0.0))) if (det != T(0.0))
{ {
// http://stackoverflow.com/questions/1148309/inverting-a-4x4-matrix // http://stackoverflow.com/questions/1148309/inverting-a-4x4-matrix
T inv[16]; T inv[16];
@ -484,7 +484,7 @@ namespace Nz
#endif #endif
T det = GetDeterminantAffine(); T det = GetDeterminantAffine();
if (!NumberEquals(det, F(0.0))) if (det != F(0.0))
{ {
// http://stackoverflow.com/questions/1148309/inverting-a-4x4-matrix // http://stackoverflow.com/questions/1148309/inverting-a-4x4-matrix
T inv[16]; T inv[16];
@ -790,10 +790,7 @@ namespace Nz
template<typename T> template<typename T>
bool Matrix4<T>::IsAffine() const bool Matrix4<T>::IsAffine() const
{ {
return NumberEquals(m14, F(0.0)) && return m14 == F(0.0) && m24 == F(0.0) && m34 == F(0.0) && m44 == F(1.0);
NumberEquals(m24, F(0.0)) &&
NumberEquals(m34, F(0.0)) &&
NumberEquals(m44, F(1.0));
} }
/*! /*!