Skip to content
Snippets Groups Projects
Commit d16256a8 authored by Michael Kuron's avatar Michael Kuron :mortar_board:
Browse files

assert on invalid quaternion normalization

parent bbd20eb7
Branches
Tags
No related merge requests found
...@@ -517,9 +517,7 @@ template< typename Type > // Data type of the quaternion ...@@ -517,9 +517,7 @@ template< typename Type > // Data type of the quaternion
inline Quaternion<Type>& Quaternion<Type>::normalize() 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] ) ); const Type len( std::sqrt( v_[0]*v_[0] + v_[1]*v_[1] + v_[2]*v_[2] + v_[3]*v_[3] ) );
WALBERLA_ASSERT_NOT_IDENTICAL( len, Type(0) );
if( isIdentical(len, Type(0)) )
return *this;
const Type ilen( Type(1)/len ); const Type ilen( Type(1)/len );
...@@ -542,9 +540,7 @@ template< typename Type > // Data type of the quaternion ...@@ -542,9 +540,7 @@ template< typename Type > // Data type of the quaternion
inline const Quaternion<Type> Quaternion<Type>::getNormalized() const 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] ) ); const Type len( std::sqrt( v_[0]*v_[0] + v_[1]*v_[1] + v_[2]*v_[2] + v_[3]*v_[3] ) );
WALBERLA_ASSERT_NOT_IDENTICAL( len, Type(0) );
if( isIdentical(len, Type(0)) )
return *this;
const Type ilen( Type(1)/len ); const Type ilen( Type(1)/len );
......
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment