quaternion: Added new "normalized" function which returns the normalized form of the argument

This commit is contained in:
Henry
2012-07-13 10:24:47 +01:00
parent 91ff5bcb92
commit 13f46fd889
2 changed files with 8 additions and 0 deletions

View File

@ -140,6 +140,8 @@ public:
//- The rotation tensor corresponding the quaternion
inline tensor R() const;
inline quaternion normalized() const;
// Edit

View File

@ -166,6 +166,12 @@ inline Foam::vector& Foam::quaternion::v()
}
inline Foam::quaternion Foam::quaternion::normalized() const
{
return *this/mag(*this);
}
inline void Foam::quaternion::normalize()
{
operator/=(mag(*this));