aboutsummaryrefslogtreecommitdiffstats
path: root/linmath.h
diff options
context:
space:
mode:
Diffstat (limited to 'linmath.h')
-rw-r--r--linmath.h7
1 files changed, 4 insertions, 3 deletions
diff --git a/linmath.h b/linmath.h
index d0e1f00..b368739 100644
--- a/linmath.h
+++ b/linmath.h
@@ -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);