diff options
| -rw-r--r-- | src/util/mini_math.h | 5 |
1 files changed, 5 insertions, 0 deletions
diff --git a/src/util/mini_math.h b/src/util/mini_math.h index f60e27e..29dc38f 100644 --- a/src/util/mini_math.h +++ b/src/util/mini_math.h @@ -117,6 +117,8 @@ struct vec3 { #if defined(USE_QUAT) // Rotate this vector by a quaternion vec3 rotate(const quat& q) const; + // Rotate this vector around an axis by an angle + vec3 rotate(const vec3& axis, float angle) const; #endif static vec3 cross(vec3 a, vec3 b) { @@ -441,6 +443,9 @@ inline quat slerp(quat a, quat b, float t) { inline vec3 vec3::rotate(const quat& q) const { return q.rotate(*this); } +inline vec3 vec3::rotate(const vec3& axis, float angle) const { + return quat::from_axis(axis, angle).rotate(*this); +} #endif #endif /* defined(USE_QUAT) */ |
