aboutsummaryrefslogtreecommitdiff
path: root/tools/plot_lighthouse/glutil.c
diff options
context:
space:
mode:
authorJosh Allen <axlecrusher@gmail.com>2017-02-13 15:57:41 -0500
committerJosh Allen <axlecrusher@gmail.com>2017-02-13 15:57:41 -0500
commit6c99f7abf29463df723221dcaa8c3fe7c93c3371 (patch)
tree562b87e108460eea416cedc183b1ce333bee386e /tools/plot_lighthouse/glutil.c
parentfa88e40fa07c3cf425b45fe56cf6dda613545e36 (diff)
parentee433e4a076f77fa28e4d55d6703d6ed7c599251 (diff)
downloadlibsurvive-6c99f7abf29463df723221dcaa8c3fe7c93c3371.tar.gz
libsurvive-6c99f7abf29463df723221dcaa8c3fe7c93c3371.tar.bz2
Merge github.com:cnlohr/libsurvive
Diffstat (limited to 'tools/plot_lighthouse/glutil.c')
-rw-r--r--tools/plot_lighthouse/glutil.c31
1 files changed, 15 insertions, 16 deletions
diff --git a/tools/plot_lighthouse/glutil.c b/tools/plot_lighthouse/glutil.c
index dd022a0..99c15f7 100644
--- a/tools/plot_lighthouse/glutil.c
+++ b/tools/plot_lighthouse/glutil.c
@@ -50,24 +50,23 @@ void DrawCoordinateSystem(
float x, float y, float z,
float qx, float qy, float qz, float qr)
{
- Quaternion i0,j0,k0;
- Quaternion i, j, k;
- Quaternion q;
-
- // Calculate the i, j, and k vectors
- QuaternionSet(i0, 1, 0, 0, 0);
- QuaternionSet(j0, 0, 1, 0, 0);
- QuaternionSet(k0, 0, 0, 1, 0);
- QuaternionSet(q, qx, qy, qz, qr);
- QuaternionRot(i, q, i0);
- QuaternionRot(j, q, j0);
- QuaternionRot(k, q, k0);
+ FLT i0[3],j0[3],k0[3];
+ FLT i[3],j[3],k[3];
+ FLT q[4];
+
+ i0[0]=1.0; i0[1]=0.0; i0[2]=0.0;
+ j0[0]=0.0; j0[1]=1.0; j0[2]=0.0;
+ k0[0]=0.0; k0[1]=0.0; k0[2]=1.0;
+ q [0]=qr; q [1]=qx; q [2]=qy; q [3]=qz;
- // Draw the coordinate system i red, j green, k blue
+ quatrotatevector(i, q, i0);
+ quatrotatevector(j, q, j0);
+ quatrotatevector(k, q, k0);
+
glBegin(GL_LINES);
- glColor3f(1, 0, 0); glVertex3f(x,z,y); glVertex3f(x+i.i,z+i.k,y+i.j);
- glColor3f(0, 1, 0); glVertex3f(x,z,y); glVertex3f(x+j.i,z+j.k,y+j.j);
- glColor3f(0, 0, 1); glVertex3f(x,z,y); glVertex3f(x+k.i,z+k.k,y+k.j);
+ glColor3f(1, 0, 0); glVertex3f(x,z,y); glVertex3f(x+i[0],z+i[2],y+i[1]);
+ glColor3f(0, 1, 0); glVertex3f(x,z,y); glVertex3f(x+j[0],z+j[2],y+j[1]);
+ glColor3f(0, 0, 1); glVertex3f(x,z,y); glVertex3f(x+k[0],z+k[2],y+k[1]);
glEnd();
}