39#ifndef Foam_quaternion_H
40#define Foam_quaternion_H
73 inline static vector twoAxes
83 inline static vector threeAxes
130 static constexpr const char*
const typeName =
"quaternion";
164 const scalar cosTheta,
165 const bool isNormalised
244 inline
void operator=(const scalar
s);
247 inline
void operator=(const
vector&
v);
250 inline
void operator=(const
Foam::
zero);
252 inline
void operator*=(const scalar
s);
253 inline
void operator/=(const scalar
s);
298inline quaternion
inv(
const quaternion& q);
301word
name(
const quaternion& q);
306 const quaternion& qa,
307 const quaternion& qb,
314 const UList<quaternion>& qs,
315 const UList<scalar> w
319quaternion
exp(
const quaternion& q);
322quaternion
pow(
const quaternion& q,
const label power);
325quaternion
pow(
const quaternion& q,
const scalar power);
330Istream&
operator>>(Istream& is, quaternion& q);
333inline bool operator==(
const quaternion& q1,
const quaternion& q2);
334inline bool operator!=(
const quaternion& q1,
const quaternion& q2);
335inline quaternion
operator+(
const quaternion& q1,
const quaternion& q2);
336inline quaternion
operator-(
const quaternion& q);
337inline quaternion
operator-(
const quaternion& q1,
const quaternion& q2);
338inline scalar
operator&(
const quaternion& q1,
const quaternion& q2);
339inline quaternion
operator*(
const quaternion& q1,
const quaternion& q2);
340inline quaternion
operator/(
const quaternion& q1,
const quaternion& q2);
341inline quaternion
operator*(
const scalar
s,
const quaternion& q);
342inline quaternion
operator*(
const quaternion& q,
const scalar
s);
343inline quaternion
operator/(
const quaternion& q,
const scalar
s);
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
An Istream is an abstract base class for all input systems (streams, files, token lists etc)....
Quaternion class used to perform rotations in 3D space.
quaternion(const quaternion &)=default
Copy construct.
vector eulerAngles(const eulerOrder order) const
const vector & v() const noexcept
Vector part of the quaternion ( = axis of rotation)
tensor R() const
The rotation tensor corresponding to the quaternion.
static quaternion unit(const vector &v)
quaternion normalized() const
Return the quaternion normalised by its magnitude.
static constexpr direction rank
Rank of quaternion is 1.
scalar magType
Magnitude type.
scalar w() const noexcept
Scalar part of the quaternion ( = cos(theta/2) for rotation)
quaternion & normalise()
Inplace normalise the quaternion by its magnitude.
quaternion & operator=(const quaternion &)=default
Copy assignment.
vector transform(const vector &v) const
Rotate the given vector.
quaternion()=default
Default construct.
static constexpr const char *const typeName
static const Enum< eulerOrder > eulerOrderNames
scalar cmptType
Component type.
static const quaternion I
void normalize()
Inplace normalise the quaternion by its magnitude.
eulerOrder
Euler-angle rotation order.
static const quaternion zero
vector invTransform(const vector &v) const
Rotate the given vector anti-clockwise.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
OBJstream os(runTime.globalPath()/outputName)
gmvFile<< "tracers "<< particles.size()<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().x()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().y()<< " ";}gmvFile<< nl;for(const passiveParticle &p :particles){ gmvFile<< p.position().z()<< " ";}gmvFile<< nl;forAll(lagrangianScalarNames, i){ word name=lagrangianScalarNames[i];IOField< scalar > s(IOobject(name, runTime.timeName(), cloud::prefix, mesh, IOobject::MUST_READ, IOobject::NO_WRITE))
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
bool operator!=(const eddy &a, const eddy &b)
dimensionedScalar exp(const dimensionedScalar &ds)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
quaternion normalize(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &df)
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
Istream & operator>>(Istream &, directionInfo &)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
quaternion conjugate(const quaternion &q)
Return the conjugate of the given quaternion.
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
#define FOAM_DEPRECATED_FOR(since, replacement)
A template class to specify if a data type is composed solely of Foam::scalar elements.
A template class to specify that a data type can be considered as being contiguous in memory.