Clean up quaternion notation weirdness
authorparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Thu, 8 Apr 2010 12:07:38 +0000 (12:07 +0000)
committerparasti <parasti@78b8d119-cf0a-0410-b17c-f493084dd1d7>
Thu, 8 Apr 2010 12:07:38 +0000 (12:07 +0000)
git-svn-id: https://s.snth.net/svn/neverball/trunk@3161 78b8d119-cf0a-0410-b17c-f493084dd1d7

share/vec3.c
share/vec3.h

index 8816cc4..84a2ef4 100644 (file)
@@ -297,13 +297,13 @@ void m_view(float *M,
 
 /*---------------------------------------------------------------------------*/
 
-void q_axisangle(const float *q, float *u, float *a)
+void q_axisangle(const float q[4], float u[3], float *a)
 {
     *a = V_DEG(2.0f * facosf(q[0]));
     v_nrm(u, q + 1);
 }
 
-void q_nrm(float *q, const float *r)
+void q_nrm(float q[4], const float r[4])
 {
     float d = q_len(r);
 
@@ -323,7 +323,7 @@ void q_nrm(float *q, const float *r)
     }
 }
 
-void q_euler(float *v, const float *q)
+void q_euler(float v[3], const float q[4])
 {
     float m11 = (2 * q[0] * q[0]) + (2 * q[1] * q[1]) - 1;
     float m12 = (2 * q[1] * q[2]) + (2 * q[0] * q[3]);
index 4d8e2cf..e386fc6 100644 (file)
@@ -110,15 +110,15 @@ void   m_view(float *, const float *,
 #define q_dot(q, r) ((q)[0] * (r)[0] + v_dot((q) + 1, (r) + 1))
 #define q_len(q)    fsqrtf(q_dot((q), (q)))
 
-#define q_cpy(q, p) do { \
-    (q)[0] = (p)[0];     \
-    (q)[1] = (p)[1];     \
-    (q)[2] = (p)[2];     \
-    (q)[3] = (p)[3];     \
+#define q_cpy(q, r) do { \
+    (q)[0] = (r)[0];     \
+    (q)[1] = (r)[1];     \
+    (q)[2] = (r)[2];     \
+    (q)[3] = (r)[3];     \
 } while (0)
 
-void q_axisangle(const float *q, float *u, float *a);
-void q_nrm(float *q, const float *r);
-void q_euler(float *v, const float *q);
+void q_axisangle(const float q[4], float u[3], float *a);
+void q_nrm(float q[4], const float r[4]);
+void q_euler(float v[3], const float q[4]);
 
 #endif