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);
276 template<>
struct is_contiguous<quaternion> : std::true_type {};
279 template<>
struct is_contiguous_scalar<quaternion> : std::true_type {};
284 inline scalar
magSqr(
const quaternion& q);
285 inline scalar
mag(
const quaternion& q);
288 inline quaternion
conjugate(
const quaternion& q);
291 inline quaternion
normalised(
const quaternion& q);
298 inline quaternion
inv(
const quaternion& q);
301 word
name(
const quaternion& q);
306 const quaternion& qa,
307 const quaternion& qb,
314 const UList<quaternion>& qs,
315 const UList<scalar> w
319 quaternion
exp(
const quaternion& q);
322 quaternion
pow(
const quaternion& q,
const label power);
325 quaternion
pow(
const quaternion& q,
const scalar power);
330 Istream&
operator>>(Istream& is, quaternion& q);
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
tensor R() const
The rotation tensor corresponding to the quaternion.
quaternion normalized() const
Return the quaternion normalised by its magnitude.
void normalize()
Inplace normalise the quaternion by its magnitude.
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
vector eulerAngles(const eulerOrder order) const
Return the Euler rotation angles corresponding to the specified rotation order.
const vector & v() const noexcept
Vector part of the quaternion ( = axis of rotation)
scalar cmptType
Component type.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
static constexpr const char *const typeName
static quaternion unit(const vector &v)
Return the unit quaternion (versor) from the given vector (w = sqrt(1 - |sqr(v)|)) ...
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
quaternion normalised(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
tmp< faMatrix< Type > > operator+(const faMatrix< Type > &, const faMatrix< Type > &)
static const Enum< eulerOrder > eulerOrderNames
The names for Euler-angle and Tait-Bryan angles, including "rollPitchYaw" and "yawPitchRoll" aliases...
class FOAM_DEPRECATED_FOR(2017-05, "Foam::Enum") NamedEnum
static const quaternion zero
scalar w() const noexcept
Scalar part of the quaternion ( = cos(theta/2) for rotation)
quaternion conjugate(const quaternion &q)
Return the conjugate of the given quaternion.
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for INVALID.
dimensionedScalar exp(const dimensionedScalar &ds)
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
Istream & operator>>(Istream &, directionInfo &)
quaternion & normalise()
Inplace normalise the quaternion by its magnitude.
Quaternion class used to perform rotations in 3D space.
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
Unary negation.
eulerOrder
Euler-angle rotation order.
A Vector of values with scalar precision, where scalar is float/double depending on the compilation f...
quaternion()=default
Default construct.
OBJstream os(runTime.globalPath()/outputName)
static const quaternion I
quaternion & operator=(const quaternion &)=default
Copy assignment.
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
static constexpr direction rank
Rank of quaternion is 1.
tmp< GeometricField< Type, faPatchField, areaMesh > > operator &(const faMatrix< Type > &, const DimensionedField< Type, areaMesh > &)
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
quaternion normalize(const quaternion &q)
Return the normalised (unit) quaternion of the given quaternion.
Includes some standard C++ headers, defines global macros and templates used in multiple places by Op...
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
bool operator!=(const eddy &a, const eddy &b)
vector invTransform(const vector &v) const
Rotate the given vector anti-clockwise.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
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))
Tensor of scalars, i.e. Tensor<scalar>.
scalar magType
Magnitude type.
vector transform(const vector &v) const
Rotate the given vector.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)