mirror of
https://develop.openfoam.com/Development/openfoam.git
synced 2025-11-28 03:28:01 +00:00
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);
This commit is contained in:
@ -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,
|
||||
|
||||
Reference in New Issue
Block a user