From d16256a805d8b15fd5e398b7dc103d201e61a450 Mon Sep 17 00:00:00 2001 From: Michael Kuron <mkuron@icp.uni-stuttgart.de> Date: Wed, 19 Jul 2017 13:17:26 +0200 Subject: [PATCH] assert on invalid quaternion normalization --- src/core/math/Quaternion.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/core/math/Quaternion.h b/src/core/math/Quaternion.h index 2c128b4d1..1278b8e22 100644 --- a/src/core/math/Quaternion.h +++ b/src/core/math/Quaternion.h @@ -517,9 +517,7 @@ template< typename Type > // Data type of the quaternion inline Quaternion<Type>& Quaternion<Type>::normalize() { const Type len( std::sqrt( v_[0]*v_[0] + v_[1]*v_[1] + v_[2]*v_[2] + v_[3]*v_[3] ) ); - - if( isIdentical(len, Type(0)) ) - return *this; + WALBERLA_ASSERT_NOT_IDENTICAL( len, Type(0) ); const Type ilen( Type(1)/len ); @@ -542,9 +540,7 @@ template< typename Type > // Data type of the quaternion inline const Quaternion<Type> Quaternion<Type>::getNormalized() const { const Type len( std::sqrt( v_[0]*v_[0] + v_[1]*v_[1] + v_[2]*v_[2] + v_[3]*v_[3] ) ); - - if( isIdentical(len, Type(0)) ) - return *this; + WALBERLA_ASSERT_NOT_IDENTICAL( len, Type(0) ); const Type ilen( Type(1)/len ); -- GitLab