diff options
author | datenwolf <code+github@datenwolf.net> | 2015-05-26 14:00:10 +0200 |
---|---|---|
committer | datenwolf <code+github@datenwolf.net> | 2015-05-26 14:00:10 +0200 |
commit | 543faf6415918e926c1ddc3e04348eed44d5ed37 (patch) | |
tree | feba75d7b39175bbd199c38c3b9ea16ee5ae406a | |
parent | a9b12ac7c333e52ca0a28664f5fa50d5a93a89db (diff) | |
parent | 0c0048c746e7ad5a81666c95da724acc82263a33 (diff) | |
download | linmath-543faf6415918e926c1ddc3e04348eed44d5ed37.tar.gz linmath-543faf6415918e926c1ddc3e04348eed44d5ed37.tar.xz linmath-543faf6415918e926c1ddc3e04348eed44d5ed37.zip |
Merge pull request #14 from PolyFloyd/quat_rotate
Added quat_rotate
-rw-r--r-- | linmath.h | 8 |
1 files changed, 8 insertions, 0 deletions
@@ -465,6 +465,14 @@ static inline void quat_conj(quat r, quat q) r[i] = -q[i]; r[3] = q[3]; } +static inline void quat_rotate(quat r, float angle, vec3 axis) { + vec3 v; + vec3_scale(v, axis, sinf(angle / 2)); + int i; + for(i=0; i<3; ++i) + r[i] = v[i]; + r[3] = cosf(angle / 2); +} #define quat_norm vec4_norm static inline void quat_mul_vec3(vec3 r, quat q, vec3 v) { |