diff options
author | datenwolf <code+github@datenwolf.net> | 2015-09-23 18:52:09 +0200 |
---|---|---|
committer | datenwolf <code+github@datenwolf.net> | 2015-09-23 18:52:09 +0200 |
commit | 6b5b43ba41d5a6334463203b15294b609f27f469 (patch) | |
tree | 26b6e79752de94b2b19183f304c100831b4d1bfb | |
parent | 06b68f6caa214d9f98ada28db837c21e08ed2927 (diff) | |
parent | de72a69abaffbf4a0861018727e10befb6cec7ff (diff) | |
download | linmath-6b5b43ba41d5a6334463203b15294b609f27f469.tar.gz linmath-6b5b43ba41d5a6334463203b15294b609f27f469.tar.xz linmath-6b5b43ba41d5a6334463203b15294b609f27f469.zip |
Merge pull request #22 from t-mw/quat_mul_vec3_fix
Fix bug in quat_mul_vec3 caused by reuse of u and t in 'vec3_mul_cross'
-rw-r--r-- | linmath.h | 7 |
1 files changed, 4 insertions, 3 deletions
@@ -481,13 +481,14 @@ static inline void quat_mul_vec3(vec3 r, quat q, vec3 v) t = 2 * cross(q.xyz, v) v' = v + q.w * t + cross(q.xyz, t) */ - vec3 t = {q[0], q[1], q[2]}; + vec3 t; + vec3 q_xyz = {q[0], q[1], q[2]}; vec3 u = {q[0], q[1], q[2]}; - vec3_mul_cross(t, t, v); + vec3_mul_cross(t, q_xyz, v); vec3_scale(t, t, 2); - vec3_mul_cross(u, u, t); + vec3_mul_cross(u, q_xyz, t); vec3_scale(t, t, q[3]); vec3_add(r, v, t); |