42 { eulerOrder::XZX,
"xzx" },
43 { eulerOrder::XYX,
"xyx" },
44 { eulerOrder::YXY,
"yxy" },
45 { eulerOrder::YZY,
"yzy" },
46 { eulerOrder::ZYZ,
"zyz" },
47 { eulerOrder::ZXZ,
"zxz" },
50 { eulerOrder::XZY,
"xzy" },
51 { eulerOrder::XYZ,
"xyz" },
52 { eulerOrder::YXZ,
"yxz" },
53 { eulerOrder::YZX,
"yzx" },
54 { eulerOrder::ZYX,
"zyx" },
55 { eulerOrder::ZXY,
"zxy" },
58 { eulerOrder::XYZ,
"rollPitchYaw" },
59 { eulerOrder::ZYX,
"yawPitchRoll" },
76 buf <<
'(' << q.w() <<
',' << q.v() <<
')';
101 const UList<quaternion>& qs,
102 const UList<scalar> w
105 quaternion qa(w[0]*qs[0]);
107 for (label i=1; i<qs.size(); i++)
110 if ((qa & qs[i]) > 0)
126 const scalar magV =
mag(q.v());
130 return quaternion(1,
Zero);
133 const scalar expW =
exp(q.w());
138 expW*
sin(magV)*q.v()/magV
145 const scalar magQ =
mag(q);
146 const scalar magV =
mag(q.v());
148 quaternion powq(q.v());
150 if (magV != 0 && magQ != 0)
153 powq *= power*
acos(q.w()/magQ);
156 return pow(magQ, power)*
exp(powq);
162 const scalar magQ =
mag(q);
163 const scalar magV =
mag(q.v());
165 quaternion powq(q.v());
167 if (magV != 0 && magQ != 0)
170 powq *= power*
acos(q.w()/magQ);
173 return pow(magQ, power)*
exp(powq);
182 is >> q.w() >> q.v();
183 is.readEnd(
"quaternion");
dimensionedScalar sign(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
dimensioned< Type > average(const DimensionedField< Type, GeoMesh > &f1)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
bool readBegin(const char *funcName)
Begin read of data chunk, starts with '('.
Input/output from string buffers.
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
An Istream is an abstract base class for all input systems (streams, files, token lists etc)...
Begin list [isseparator].
static const Enum< eulerOrder > eulerOrderNames
The names for Euler-angle and Tait-Bryan angles, including "rollPitchYaw" and "yawPitchRoll" aliases...
Useful combination of include files which define Sin, Sout and Serr and the use of IO streams general...
Foam::string str() const
Get the string. As Foam::string instead of std::string (may change in future)
static const quaternion zero
dimensionedScalar cos(const dimensionedScalar &ds)
word name(const expressions::valueTypeCode typeCode)
A word representation of a valueTypeCode. Empty for expressions::valueTypeCode::INVALID.
dimensionedScalar exp(const dimensionedScalar &ds)
A class for handling words, derived from Foam::string.
Istream & operator>>(Istream &, directionInfo &)
Quaternion class used to perform rotations in 3D space.
An Ostream is an abstract base class for all output systems (streams, files, token lists...
dimensionedScalar sin(const dimensionedScalar &ds)
quaternion()=default
Default construct.
OBJstream os(runTime.globalPath()/outputName)
static const quaternion I
dimensionedScalar pow(const dimensionedScalar &ds, const dimensionedScalar &expt)
Ostream & operator<<(Ostream &, const boundaryPatch &p)
Write boundaryPatch as dictionary entries (without surrounding braces)
Enum is a wrapper around a list of names/values that represent particular enumeration (or int) values...
quaternion slerp(const quaternion &qa, const quaternion &qb, const scalar t)
Spherical linear interpolation of quaternions.
Output to string buffer, using a OSstream. Always UNCOMPRESSED.
static constexpr const zero Zero
Global zero (0)