/* ************************************************************************* */ Vector Rot3::quaternion() const { gtsam::Quaternion q = toQuaternion(); Vector v(4); v(0) = q.w(); v(1) = q.x(); v(2) = q.y(); v(3) = q.z(); return v; }
/** * @brief convert * @param src * @return */ void convertRepresentationTo(OrientationType repType) { if(repType == Euler) { toEulers(); } else if(repType == OrientationMatrix) { toOrientationMatrix(); } else if(repType == Quaternion) { toQuaternion(); } else if(repType == AxisAngle) { toAxisAngle(); } else if(repType == Rodrigues) { toRodrigues(); } else if(repType == Homochoric) { toHomochoric(); } else if(repType == Cubochoric) { toCubochoric(); } }
/// Apply the euler rotation to the vector rhs. inline Vector3 operator*(const Vector3 &rhs) const { return toQuaternion() * rhs; }
/// Casting operator. This allows any ogre function that wants a Quaternion to accept a Euler instead. inline operator Quaternion() const { return toQuaternion(); }
/// Get a vector pointing up. inline Vector3 up() const { return toQuaternion() * Vector3::UNIT_Y; }
/// Get a vector pointing to the right. inline Vector3 right() const { return toQuaternion() * Vector3::UNIT_X; }
/// Get a vector pointing forwards. inline Vector3 forward() const { return toQuaternion() * Vector3::NEGATIVE_UNIT_Z; }
inline void lookAt(const Vector3f& dest, const Vector3f& up = {0, 1, 0}) { transform.rotation = toQuaternion(m_lookAt(transform.position, dest, up)); }