23#define GLM_FORCE_RADIANS
30 template <
typename Real>
106 Real cr = glm::cos(roll * 0.5);
107 Real sr = glm::sin(roll * 0.5);
108 Real cp = glm::cos(pitch * 0.5);
109 Real sp = glm::sin(pitch * 0.5);
110 Real cy = glm::cos(yaw * 0.5);
111 Real sy = glm::sin(yaw * 0.5);
114 q.
w = cr * cp * cy + sr * sp * sy;
115 q.
x = sr * cp * cy - cr * sp * sy;
116 q.
y = cr * sp * cy + sr * cp * sy;
117 q.
z = cr * cp * sy - sr * sp * cy;
127 template <
typename S,
typename T>
133 template class Quat<float>;
134 template class Quat<double>;
DYN_FUNC Quat< Real > & operator-=(const Quat< Real > &)
DYN_FUNC Quat< Real > & normalize()
DYN_FUNC Quat(Real rot, const Vector< Real, 3 > &axis)
Construct a quaternion from a rotation and a unit vector.
DYN_FUNC Quat< Real > operator-(void) const
DYN_FUNC void toRotationAxis(Real &rot, Vector< Real, 3 > &axis) const
DYN_FUNC Real angle(const Quat< Real > &) const
DYN_FUNC Quat(const Real yaw, const Real pitch, const Real roll)
DYN_FUNC Real normSquared() const
DYN_FUNC Quat(const Quat< Real > &)
static DYN_FUNC Quat< Real > fromEulerAngles(const Real &yaw, const Real &pitch, const Real &roll)
DYN_FUNC Quat< Real > conjugate() const
DYN_FUNC Quat(Real x, Real y, Real z, Real w)
Construct a quaternion, be aware that w is the scalar part and (x, y, z) is the vector part.
DYN_FUNC Quat(const SquareMatrix< Real, 4 > &)
DYN_FUNC Quat< Real > inverse() const
DYN_FUNC Quat< Real > operator/(const Real &) const
DYN_FUNC Quat< Real > operator+(const Quat< Real > &) const
DYN_FUNC bool operator==(const Quat< Real > &) const
DYN_FUNC Real dot(const Quat< Real > &) const
DYN_FUNC Quat< Real > & operator=(const Quat< Real > &)
DYN_FUNC void toEulerAngle(Real &yaw, Real &pitch, Real &roll) const
DYN_FUNC Quat(const Vector< Real, 3 > u0, const Vector< Real, 3 > u1)
DYN_FUNC Quat(const SquareMatrix< Real, 3 > &)
DYN_FUNC Real norm() const
DYN_FUNC Quat< Real > operator*(const Quat< Real > &) const
DYN_FUNC Real angle() const
DYN_FUNC SquareMatrix< Real, 3 > toMatrix3x3() const
static DYN_FUNC Quat< Real > identity()
DYN_FUNC Quat< Real > & operator+=(const Quat< Real > &)
DYN_FUNC bool operator!=(const Quat< Real > &) const
DYN_FUNC Vector< Real, 3 > rotate(const Vector< Real, 3 > &v) const
Rotate a vector by the quaternion, guarantee the quaternion is normalized before rotating the vector.
DYN_FUNC SquareMatrix< Real, 4 > toMatrix4x4() const
This is an implementation of AdditiveCCD based on peridyno.
DYN_FUNC const Complex< T > operator*(S scale, const Complex< T > &complex)