From a2d7c21a7e895c592e7c2a64e9ffd615428c1fb8 Mon Sep 17 00:00:00 2001 From: Phillip Stephens Date: Tue, 2 Feb 2016 00:29:16 -0800 Subject: [PATCH] rotate* helper functions --- include/CQuaternion.hpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/CQuaternion.hpp b/include/CQuaternion.hpp index b6152ee..1e9a38b 100644 --- a/include/CQuaternion.hpp +++ b/include/CQuaternion.hpp @@ -102,6 +102,11 @@ public: return CQuaternion(cosf(angle/2), axis*sinf(angle/2)); } + void rotateX(float angle) { *this *= fromAxisAngle({1.0f, 0.0f, 0.0f}, angle); } + void rotateY(float angle) { *this *= fromAxisAngle({0.0f, 1.0f, 0.0f}, angle); } + void rotateZ(float angle) { *this *= fromAxisAngle({0.0f, 0.0f, 1.0f}, angle); } + + CAxisAngle toAxisAngle(); static inline CVector3f rotate(const CQuaternion& rotation, const CVector3f& v)