55 const scalar cosTheta,
56 const bool isNormalised
59 const scalar cosHalfTheta2 = 0.5*(cosTheta + 1);
60 w_ =
sqrt(cosHalfTheta2);
64 v_ =
sqrt(1 - cosHalfTheta2)*d;
199 <<
"Unknown euler rotation order "
327 return quaternion(-(v() & u), w()*u + (v() ^ u));
339 return (
conjugate(*this).mulq0v(u)*(*
this)).v();
360 const scalar
w2 =
sqr(w());
361 const scalar x2 =
sqr(v().
x());
362 const scalar y2 =
sqr(v().
y());
363 const scalar z2 =
sqr(v().z());
365 const scalar txy = 2*v().x()*v().y();
366 const scalar twz = 2*w()*v().z();
367 const scalar txz = 2*v().x()*v().z();
368 const scalar twy = 2*w()*v().y();
369 const scalar tyz = 2*v().y()*v().z();
370 const scalar twx = 2*w()*v().x();
374 w2 + x2 - y2 - z2, txy - twz, txz + twy,
375 txy + twz,
w2 - x2 + y2 - z2, tyz - twx,
376 txz - twy, tyz + twx,
w2 - x2 - y2 + z2
412 const scalar
w2 =
sqr(w());
413 const scalar x2 =
sqr(v().
x());
414 const scalar y2 =
sqr(v().
y());
415 const scalar z2 =
sqr(v().z());
423 2*(v().
x()*v().
y() + w()*v().z()),
425 2*(w()*v().
y() - v().
x()*v().z()),
426 2*(v().
y()*v().z() + w()*v().
x()),
436 2*(v().
y()*v().z() - w()*v().
x()),
437 2*(v().
x()*v().z() + w()*v().
y()),
439 2*(v().
y()*v().z() + w()*v().
x()),
440 2*(w()*v().
y() - v().
x()*v().z())
449 2*(w()*v().z() - v().
x()*v().
y()),
451 2*(v().
y()*v().z() + w()*v().
x()),
452 2*(w()*v().
y() - v().
x()*v().z()),
462 2*(v().
x()*v().z() + w()*v().
y()),
463 2*(w()*v().
x() - v().
y()*v().z()),
465 2*(v().
x()*v().z() - w()*v().
y()),
466 2*(v().
y()*v().z() + w()*v().
x())
475 2*(v().
x()*v().z() + w()*v().
y()),
477 2*(w()*v().
x() - v().
y()*v().z()),
478 2*(v().
x()*v().
y() + w()*v().z()),
488 2*(v().
x()*v().
y() - w()*v().z()),
489 2*(v().
y()*v().z() + w()*v().
x()),
491 2*(v().
x()*v().
y() + w()*v().z()),
492 2*(w()*v().
x() - v().
y()*v().z())
501 2*(w()*v().
y() - v().
x()*v().z()),
503 2*(v().
x()*v().
y() + w()*v().z()),
504 2*(w()*v().
x() - v().
y()*v().z()),
514 2*(v().
y()*v().z() + w()*v().
x()),
515 2*(w()*v().z() - v().
x()*v().
y()),
517 2*(v().
y()*v().z() - w()*v().
x()),
518 2*(v().
x()*v().
y() + w()*v().z())
527 2*(w()*v().
x() - v().
y()*v().z()),
529 2*(v().
x()*v().z() + w()*v().
y()),
530 2*(w()*v().z() - v().
x()*v().
y()),
540 2*(v().
x()*v().
y() + w()*v().z()),
541 2*(w()*v().
y() - v().
x()*v().z()),
543 2*(v().
x()*v().
y() - w()*v().z()),
544 2*(v().
x()*v().z() + w()*v().
y())
553 2*(v().
y()*v().z() + w()*v().
x()),
555 2*(w()*v().z() - v().
x()*v().
y()),
556 2*(v().
x()*v().z() + w()*v().
y()),
566 2*(v().
x()*v().z() - w()*v().
y()),
567 2*(v().
x()*v().
y() + w()*v().z()),
569 2*(v().
x()*v().z() + w()*v().
y()),
570 2*(w()*v().z() - v().
x()*v().
y())
577 <<
"Unknown euler rotation order "
603 w() = w()*q.
w() - (v() & q.
v());
604 v() =
w0*q.
v() + q.
w()*v() + (v() ^ q.
v());
609 return operator*=(
inv(q));
715 return quaternion(q1.w() + q2.w(), q1.v() + q2.v());
731 return quaternion(q1.w() - q2.w(), q1.v() - q2.v());
737 return q1.
w()*q2.
w() + (q1.
v() & q2.
v());
749 q1.w()*q2.w() - (q1.v() & q2.v()),
750 q1.w()*q2.v() + q2.w()*q1.v() + (q1.v() ^ q2.v())
const Cmpt & z() const
Access to the vector z component.
const Cmpt & y() const
Access to the vector y component.
const Cmpt & x() const
Access to the vector x component.
virtual word unit() const
Return time unit.
Quaternion class used to perform rotations in 3D space.
void operator/=(const quaternion &q)
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.
void operator-=(const quaternion &q)
void operator+=(const quaternion &q)
void operator*=(const quaternion &q)
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.
quaternion()=default
Default construct.
eulerOrder
Euler-angle rotation order.
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 ...
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
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 asin(const dimensionedScalar &ds)
dimensionedSymmTensor sqr(const dimensionedVector &dv)
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.
dimensionedScalar sin(const dimensionedScalar &ds)
tmp< faMatrix< Type > > operator*(const areaScalarField::Internal &, const faMatrix< Type > &)
tmp< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
bool equal(const T &s1, const T &s2)
Compare two values for equality.
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
errorManip< error > abort(error &err)
static constexpr const zero Zero
Global zero (0)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
quaternion conjugate(const quaternion &q)
Return the conjugate of the given quaternion.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
dimensionedScalar cos(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)