15 "length of vector less than 1e-12");
36 const double tol = 1
e-12;
57 axis -=
dot(axis, ref) *
ref;
58 axis = normalize(axis);
65 double cosAngle =
sqrt(0.5 * (1 +
dot(u, ref)));
66 double sinAngle =
sqrt(1 - cosAngle * cosAngle);
81 return result *= other;
89 *
this =
Quaternion((*
this)(0) * other(0) -
dot(imagThis, imagOther),
90 (*
this)(0) * imagOther + other(0) * imagThis +
cross(imagThis, imagOther));
105 if (this->
Norm() < 1
e-12)
107 "length of quaternion less than 1e-12");
110 (*this) /= this->
length();
127 "quaternion isn't unit quaternion. Norm: " + std::to_string(this->
Norm()));
132 return ((*
this) * (quat * (*this).
conjugate())).imag();
141 mat(0, 0) = 1 - 2 * (rot(2) * rot(2) + rot(3) * rot(3));
142 mat(0, 1) = 2 * (-rot(0) * rot(3) + rot(1) * rot(2));
143 mat(0, 2) = 2 * (rot(0) * rot(2) + rot(1) * rot(3));
144 mat(1, 0) = 2 * (rot(0) * rot(3) + rot(1) * rot(2));
145 mat(1, 1) = 1 - 2 * (rot(1) * rot(1) + rot(3) * rot(3));
146 mat(1, 2) = 2 * (-rot(0) * rot(1) + rot(2) * rot(3));
147 mat(2, 0) = 2 * (-rot(0) * rot(2) + rot(1) * rot(3));
148 mat(2, 1) = 2 * (rot(0) * rot(1) + rot(2) * rot(3));
149 mat(2, 2) = 1 - 2 * (rot(1) * rot(1) + rot(2) * rot(2));
matrix_t getRotationMatrix() const
boost::numeric::ublas::matrix< double > matrix_t
Tps< T > sqrt(const Tps< T > &x)
Square root.
Quaternion conjugate() const
Vector_t rotate(const Vector_t &) const
Quaternion operator/(const double &) const
PETE_TBTree< FnCopysign, PETE_Scalar< Vektor< T1, Dim > >, typename T2::PETE_Expr_t > copysign(const Vektor< T1, Dim > &l, const PETE_Expr< T2 > &r)
PETE_TUTree< FnAbs, typename T::PETE_Expr_t > abs(const PETE_Expr< T > &l)
Vektor< double, 3 > Vector_t
RandomNumberGen IpplRandom
constexpr double pi
The value of .
T::PETE_Expr_t::PETE_Return_t max(const PETE_Expr< T > &expr, NDIndex< D > &loc)
Quaternion inverse() const
Vector3D cross(const Vector3D &lhs, const Vector3D &rhs)
Vector cross product.
Quaternion operator*(const double &) const
Tps< T > cos(const Tps< T > &x)
Cosine.
Quaternion getQuaternion(Vector_t u, Vector_t ref)
Quaternion & operator*=(const Quaternion &)
constexpr double e
The value of .
Tps< T > sin(const Tps< T > &x)
Sine.
double dot(const Vector3D &lhs, const Vector3D &rhs)
Vector dot product.