Go to the documentation of this file.
48 v_((
sin(0.5*theta)/
mag(d))*d)
55 const scalar cosTheta,
59 scalar cosHalfTheta2 = 0.5*(cosTheta + 1);
60 w_ =
sqrt(cosHalfTheta2);
64 v_ =
sqrt(1 - cosHalfTheta2)*d;
68 v_ = (
sqrt(1 - cosHalfTheta2)/
mag(d))*d;
199 <<
"Unknown euler rotation order "
311 return *
this/
mag(*
this);
317 operator/=(
mag(*
this));
323 return quaternion(-(v() & u), w()*u + (v() ^ u));
335 return (
conjugate(*this).mulq0v(u)*(*this)).v();
356 const scalar
w2 =
sqr(w());
357 const scalar x2 =
sqr(v().
x());
358 const scalar y2 =
sqr(v().
y());
359 const scalar z2 =
sqr(v().z());
361 const scalar txy = 2*v().x()*v().y();
362 const scalar twz = 2*w()*v().z();
363 const scalar txz = 2*v().x()*v().z();
364 const scalar twy = 2*w()*v().y();
365 const scalar tyz = 2*v().y()*v().z();
366 const scalar twx = 2*w()*v().x();
370 w2 + x2 - y2 - z2, txy - twz, txz + twy,
371 txy + twz,
w2 - x2 + y2 - z2, tyz - twx,
372 txz - twy, tyz + twx,
w2 - x2 - y2 + z2
408 const scalar
w2 =
sqr(w());
409 const scalar x2 =
sqr(v().
x());
410 const scalar y2 =
sqr(v().
y());
411 const scalar z2 =
sqr(v().z());
419 2*(v().
x()*v().
y() + w()*v().z()),
421 2*(w()*v().
y() - v().
x()*v().z()),
422 2*(v().
y()*v().z() + w()*v().
x()),
432 2*(v().
y()*v().z() - w()*v().
x()),
433 2*(v().
x()*v().z() + w()*v().
y()),
435 2*(v().
y()*v().z() + w()*v().
x()),
436 2*(w()*v().
y() - v().
x()*v().z())
445 2*(w()*v().z() - v().
x()*v().
y()),
447 2*(v().
y()*v().z() + w()*v().
x()),
448 2*(w()*v().
y() - v().
x()*v().z()),
458 2*(v().
x()*v().z() + w()*v().
y()),
459 2*(w()*v().
x() - v().
y()*v().z()),
461 2*(v().
x()*v().z() - w()*v().
y()),
462 2*(v().
y()*v().z() + w()*v().
x())
471 2*(v().
x()*v().z() + w()*v().
y()),
473 2*(w()*v().
x() - v().
y()*v().z()),
474 2*(v().
x()*v().
y() + w()*v().z()),
484 2*(v().
x()*v().
y() - w()*v().z()),
485 2*(v().
y()*v().z() + w()*v().
x()),
487 2*(v().
x()*v().
y() + w()*v().z()),
488 2*(w()*v().
x() - v().
y()*v().z())
497 2*(w()*v().
y() - v().
x()*v().z()),
499 2*(v().
x()*v().
y() + w()*v().z()),
500 2*(w()*v().
x() - v().
y()*v().z()),
510 2*(v().
y()*v().z() + w()*v().
x()),
511 2*(w()*v().z() - v().
x()*v().
y()),
513 2*(v().
y()*v().z() - w()*v().
x()),
514 2*(v().
x()*v().
y() + w()*v().z())
523 2*(w()*v().
x() - v().
y()*v().z()),
525 2*(v().
x()*v().z() + w()*v().
y()),
526 2*(w()*v().z() - v().
x()*v().
y()),
536 2*(v().
x()*v().
y() + w()*v().z()),
537 2*(w()*v().
y() - v().
x()*v().z()),
539 2*(v().
x()*v().
y() - w()*v().z()),
540 2*(v().
x()*v().z() + w()*v().
y())
549 2*(v().
y()*v().z() + w()*v().
x()),
551 2*(w()*v().z() - v().
x()*v().
y()),
552 2*(v().
x()*v().z() + w()*v().
y()),
562 2*(v().
x()*v().z() - w()*v().
y()),
563 2*(v().
x()*v().
y() + w()*v().z()),
565 2*(v().
x()*v().z() + w()*v().
y()),
566 2*(w()*v().z() - v().
x()*v().
y())
573 <<
"Unknown euler rotation order "
599 w() = w()*q.
w() - (v() & q.
v());
600 v() =
w0*q.
v() + q.
w()*v() + (v() ^ q.
v());
605 return operator*=(
inv(q));
656 scalar magSqrq =
magSqr(q);
709 return q1.
w()*q2.
w() + (q1.
v() & q2.
v());
721 q1.
w()*q2.w() - (q1.
v() & q2.v()),
722 q1.
w()*q2.v() + q2.w()*q1.
v() + (q1.
v() ^ q2.v())
void normalize()
Normalize the quaternion by its magnitude.
const Cmpt & x() const
Access to the vector x component.
void operator+=(const quaternion &q)
const vector & v() const
Vector part of the quaternion ( = axis of rotation)
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< GeometricField< Type, fvPatchField, volMesh > > operator&(const fvMatrix< Type > &, const DimensionedField< Type, volMesh > &)
static constexpr const zero Zero
Global zero (0)
quaternion & operator=(const quaternion &)=default
Copy assignment.
dimensionedScalar sin(const dimensionedScalar &ds)
void operator/=(const quaternion &q)
dimensionedScalar atan2(const dimensionedScalar &x, const dimensionedScalar &y)
tmp< faMatrix< Type > > operator-(const faMatrix< Type > &)
quaternion normalized() const
Return the quaternion normalized by its magnitude.
void operator-=(const quaternion &q)
vector eulerAngles(const eulerOrder order) const
scalar w() const
Scalar part of the quaternion ( = cos(theta/2) for rotation)
const Cmpt & z() const
Access to the vector z component.
quaternion()=default
Default construct.
Quaternion class used to perform rotations in 3D space.
dimensioned< typename typeOfMag< Type >::type > magSqr(const dimensioned< Type > &dt)
bool operator!=(const eddy &a, const eddy &b)
tmp< faMatrix< Type > > operator==(const faMatrix< Type > &, const faMatrix< Type > &)
dimensionedSphericalTensor inv(const dimensionedSphericalTensor &dt)
eulerOrder
Euler-angle rotation order.
static quaternion unit(const vector &v)
errorManip< error > abort(error &err)
const dimensionedScalar c2
Second radiation constant: default SI units: [m.K].
Vector< scalar > vector
A scalar version of the templated Vector.
dimensionedScalar operator/(const scalar s1, const dimensionedScalar &ds2)
const Cmpt & y() const
Access to the vector y component.
#define FatalErrorInFunction
Report an error message using Foam::FatalError.
dimensionedSymmTensor sqr(const dimensionedVector &dv)
void operator*=(const quaternion &q)
dimensionedScalar sqrt(const dimensionedScalar &ds)
dimensionedScalar acos(const dimensionedScalar &ds)
dimensioned< typename typeOfMag< Type >::type > mag(const dimensioned< Type > &dt)
tmp< faMatrix< Type > > operator*(const areaScalarField &, const faMatrix< Type > &)
vector invTransform(const vector &v) const
Rotate the given vector anti-clockwise.
tensor R() const
The rotation tensor corresponding to the quaternion.
quaternion conjugate(const quaternion &q)
Return the conjugate of the given quaternion.
tensor rotationTensor(const vector &n1, const vector &n2)
Rotational transformation tensor from vector n1 to n2.
bool equal(const T &s1, const T &s2)
Compare two values for equality.
Tensor< scalar > tensor
Tensor of scalars, i.e. Tensor<scalar>.
dimensionedScalar asin(const dimensionedScalar &ds)
quaternion normalize(const quaternion &q)
Return the normalized (unit) quaternion of the given quaternion.
vector transform(const vector &v) const
Rotate the given vector.
A class representing the concept of 0 (zero) that can be used to avoid manipulating objects known to ...
dimensionedScalar cos(const dimensionedScalar &ds)