263 return m_w * m_w + m_x * m_x + m_y * m_y + m_z * m_z;
281 return m_w * other.m_w + m_x * other.m_x + m_y * other.m_y + m_z * other.m_z;
296 return !(*
this == other);
Quaternion for representing rotations in 3D space.
void SetY(double y)
Set Y component.
static CQuaternion3d FromEulerAngles(double roll, double pitch, double yaw)
Construct quaternion from Euler angles (XYZ order).
CVector3d Rotate(const CVector3d &vector) const
Rotate vector by this quaternion.
double GetLengthSq() const
Calculate squared length of quaternion.
CQuaternion3d GetConjugate() const
Get conjugate of quaternion.
static CQuaternion3d FromAxisAngle(const CVector3d &axis, double angle)
Construct quaternion from axis and angle.
double GetW() const
Get W component (scalar part).
double GetDotProduct(const CQuaternion3d &other) const
Calculate dot product with another quaternion.
static CQuaternion3d Slerp(const CQuaternion3d &q1, const CQuaternion3d &q2, double t)
Spherical linear interpolation (SLERP) between two quaternions.
void SetX(double x)
Set X component.
CVector3d GetVectorPart() const
Get vector part of quaternion.
CQuaternion3d & operator*=(double scalar)
double GetLength() const
Calculate length (norm) of quaternion.
double GetY() const
Get Y component.
CQuaternion3d GetInverse() const
Get inverse of quaternion.
bool Serialize(iser::IArchive &archive)
Serialize this quaternion to specified archive.
void Normalize()
Normalize this quaternion in place.
CQuaternion3d()
Default constructor.
CMatrix3d ToMatrix() const
Convert quaternion to rotation matrix.
static CQuaternion3d FromMatrix(const CMatrix3d &matrix)
Construct quaternion from rotation matrix.
void SetW(double w)
Set W component.
CQuaternion3d operator*(const CQuaternion3d &other) const
CQuaternion3d operator-(const CQuaternion3d &other) const
bool operator==(const CQuaternion3d &other) const
void ToAxisAngle(CVector3d &axis, double &angle) const
Convert quaternion to axis and angle.
void SetZ(double z)
Set Z component.
bool operator!=(const CQuaternion3d &other) const
CQuaternion3d & operator*=(const CQuaternion3d &other)
CQuaternion3d operator+(const CQuaternion3d &other) const
CQuaternion3d operator*(double scalar) const
double GetX() const
Get X component.
CQuaternion3d GetNormalized() const
Get normalized quaternion (unit quaternion).
double GetZ() const
Get Z component.
Represents a position or mathematical vector in 3D space with double precision.
Represents an input/output persistence archive for object serialization.
static const double I_BIG_EPSILON