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:
parent
4a7f5ed19a
commit
4197cb075a
2 changed files with 13 additions and 2 deletions
|
|
@ -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,
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue