Class to handle Rotations (internally the rotation is stored as a unit quaternion)
MLdouble getScalar() const
Returns the scalar part (w).
Rotation(const Matrix4 &m)
Generates a rotation from rotation matrix (result is invalid, if the matrix is not a rotation matrix)...
Vector3 rotate(const Vector3 &vec) const
Rotates the given vector and returns the result vector.
Rotation(const Rotation &)
Copy constructor.
ML_LINEAR_ALGEBRA_EXPORT friend Rotation operator*(const Rotation &a, const Rotation &b)
Multiplies two rotations with each other (see multiply).
void setRotation(const Vector3 &axis, MLdouble angle)
Builds a rotation from an axis axis and an angle angle (in radians).
Rotation()
Initializes this rotation to the identity rotation.
Rotation & conjugate()
Negates the rotation.
static Rotation slerp(const Rotation &rot1, const Rotation &rot2, MLdouble t)
Spherical linear interpolation at t between rotation rot1 and rot2.
Rotation multiply(const Rotation &rotation) const
Multiplies (concatenates) this rotation with rotation and returns the new rotation.
Rotation & operator*=(const Rotation &rotation)
Multiplies two rotations with each other (see multiply).
Rotation(MLdouble x, MLdouble y, MLdouble z, MLdouble w)
Constructs a rotation from quaternion parameters x y z w.
const Vector3 & getVector() const
Returns the vector part (x/y/z).
MLdouble _scalar
The w part of the quaternion.
Matrix4 getMatrix() const
Converts the rotation to a rotation matrix and returns the matrix.
Rotation(const Vector3 &axis, MLdouble angle)
Generates a rotation from axis and angle, the angle is given in radians.
Vector3 _vector
The x,y,z part of the quaternion.
Rotation(const Vector3 &fromVec, const Vector3 &toVec)
Generates a rotation from fromVec to toVec.
static Matrix4 slerp(const Matrix4 &m1, const Matrix4 &m2, MLdouble t)
Spherical linear interpolation at t between matrices m1 and m2.
void getRotation(Vector3 &axis, MLdouble &angle) const
Converts the rotation to an axis axis and and angle angle (in radians).
#define ML_LINEAR_ALGEBRA_EXPORT
Defines all system specific settings for all linear algebra classes.
Target mlrange_cast(Source arg)
Generic version of checked ML casts.