Commit 4197cb07 authored by Henry Weller's avatar Henry Weller
Browse files

quaternion: Added static member function to return a unit quaternion constructed from a vector

    //- Return the unit quaternion (versor) from the given vector
    //  (w = sqrt(1 - |sqr(v)|))
    static inline quaternion unit(const vector& v);
parent 4a7f5ed1
......@@ -140,12 +140,17 @@ public:
const bool normalized
);
//- Construct given scalar part, the vector part = vector::zero
//- Construct a real from the given scalar part, the vector part = zero
inline explicit quaternion(const scalar w);
//- Construct a pure quaternion given the vector part, scalar part = 0
//- Construct a pure imaginary quaternion given the vector part,
// the scalar part = 0
inline explicit quaternion(const vector& v);
//- Return the unit quaternion (versor) from the given vector
// (w = sqrt(1 - |sqr(v)|))
static inline quaternion unit(const vector& v);
//- Construct a quaternion given the three Euler angles
inline quaternion
(
......
......@@ -78,6 +78,12 @@ inline Foam::quaternion::quaternion(const vector& v)
{}
inline Foam::quaternion Foam::quaternion::unit(const vector& v)
{
return quaternion(sqrt(1 - magSqr(v)), v);
}
inline Foam::quaternion::quaternion
(
const rotationSequence rs,
......
Supports Markdown
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