added axis and angle helper methods to Quat class- script user can now get normalized axis and scalar angle from a quaternion

This commit is contained in:
Eric Levin 2015-05-04 15:22:10 -07:00
parent 5cd1c6fd23
commit e097950277
2 changed files with 10 additions and 0 deletions

View file

@ -63,6 +63,14 @@ glm::quat Quat::angleAxis(float angle, const glm::vec3& v) {
return glm::angleAxis(glm::radians(angle), v);
}
glm::vec3 Quat::axis(const glm::quat& orientation) {
return glm::axis(orientation);
}
float Quat::angle(const glm::quat &orientation) {
return glm::angle(orientation);
}
glm::quat Quat::mix(const glm::quat& q1, const glm::quat& q2, float alpha) {
return safeMix(q1, q2, alpha);
}

View file

@ -35,6 +35,8 @@ public slots:
glm::vec3 getUp(const glm::quat& orientation);
glm::vec3 safeEulerAngles(const glm::quat& orientation); // degrees
glm::quat angleAxis(float angle, const glm::vec3& v); // degrees
glm::vec3 axis(const glm::quat& orientation);
float angle(const glm::quat& orientation);
glm::quat mix(const glm::quat& q1, const glm::quat& q2, float alpha);
glm::quat slerp(const glm::quat& q1, const glm::quat& q2, float alpha);
glm::quat squad(const glm::quat& q1, const glm::quat& q2, const glm::quat& s1, const glm::quat& s2, float h);