aboutsummaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorJosh Allen <axlecrusher@gmail.com>2017-02-13 16:00:19 -0500
committerJosh Allen <axlecrusher@gmail.com>2017-02-13 16:00:19 -0500
commit7fdfd9fff265d38ae002d8007a02f746f42fd3f2 (patch)
tree5fc7e797c66e6d3af40f8c2830c267b399be3765 /tools
parent56a6bbc24962251d223536285aa407c7652c7c46 (diff)
parent6c99f7abf29463df723221dcaa8c3fe7c93c3371 (diff)
downloadlibsurvive-7fdfd9fff265d38ae002d8007a02f746f42fd3f2.tar.gz
libsurvive-7fdfd9fff265d38ae002d8007a02f746f42fd3f2.tar.bz2
Merge branch 'master' of github.com:axlecrusher/libsurvive into ootx_decoder_context_cleanup
Diffstat (limited to 'tools')
-rw-r--r--tools/plot_lighthouse/Makefile4
-rw-r--r--tools/plot_lighthouse/fileutil.c5
-rw-r--r--tools/plot_lighthouse/fileutil.h5
-rw-r--r--tools/plot_lighthouse/glutil.c31
-rw-r--r--tools/plot_lighthouse/glutil.h3
-rw-r--r--tools/plot_lighthouse/main.c5
-rw-r--r--tools/process_rawcap/process_to_points.c3
7 files changed, 33 insertions, 23 deletions
diff --git a/tools/plot_lighthouse/Makefile b/tools/plot_lighthouse/Makefile
index d156bdb..db382ea 100644
--- a/tools/plot_lighthouse/Makefile
+++ b/tools/plot_lighthouse/Makefile
@@ -1,7 +1,7 @@
UNAME := $(shell uname)
ifeq ($(UNAME), Linux)
-CFLAGS:= -lGL -lGLU -lglut
+CFLAGS:= -lGL -lGLU -lglut -I../../redist -DLINUX -lm -lpthread
endif
# Darwin is Mac OSX !!
@@ -10,6 +10,6 @@ CFLAGS:= -w -framework OpenGL -framework GLUT
endif
all:
- gcc -O3 -o plot_lighthouse main.c glutil.c fileutil.c ../../redist/os_generic.c $(CFLAGS)
+ gcc -O3 -o plot_lighthouse main.c glutil.c fileutil.c ../../redist/os_generic.c ../../redist/linmath.c $(CFLAGS)
clean:
rm -f plot_lighthouse
diff --git a/tools/plot_lighthouse/fileutil.c b/tools/plot_lighthouse/fileutil.c
index f892798..b2c8f64 100644
--- a/tools/plot_lighthouse/fileutil.c
+++ b/tools/plot_lighthouse/fileutil.c
@@ -110,7 +110,10 @@ void *ThreadReadHmtAngles(void *junk)
if ( xy[0] =='Y' ) { sweepId++; }
double angle = (PI / 400000.0) * ( (double)timeInSweep-200000.0 );
- if ( strcmp(hmd,"HMD")!=0 ) { continue; }
+ if ( strcmp(hmd,"HMD")==0 ) { id += 0; }
+ else if ( strcmp(hmd,"WM0")==0 ) { id += 32; }
+ else if ( strcmp(hmd,"WM1")==0 ) { id += 56; }
+ else { continue; }
if ( id<0 || id >NUM_HMD) { continue; }
diff --git a/tools/plot_lighthouse/fileutil.h b/tools/plot_lighthouse/fileutil.h
index 714fbbd..e5da244 100644
--- a/tools/plot_lighthouse/fileutil.h
+++ b/tools/plot_lighthouse/fileutil.h
@@ -2,7 +2,7 @@
#define _fileutil_h_
#include <pthread.h>
-#include "../../redist/os_generic.h"
+#include "os_generic.h"
void LoadLighthousePos(
const char *path,
@@ -10,7 +10,8 @@ void LoadLighthousePos(
float *qi, float *qj, float *qk, float *qreal);
-#define NUM_HMD 32
+// first 32 are hmd, next 24 wm0 next 24 wm1
+#define NUM_HMD 80
#define NUM_SWEEP 4
#define SWEEP_LX 0
#define SWEEP_LY 1
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();
}
diff --git a/tools/plot_lighthouse/glutil.h b/tools/plot_lighthouse/glutil.h
index 1014506..936701e 100644
--- a/tools/plot_lighthouse/glutil.h
+++ b/tools/plot_lighthouse/glutil.h
@@ -10,7 +10,8 @@
#define glutil_h
#include <stdio.h>
-#include "quaternion.h"
+//#include "quaternion.h"
+#include "linmath.h"
#include <stdio.h>
#ifdef __APPLE__
diff --git a/tools/plot_lighthouse/main.c b/tools/plot_lighthouse/main.c
index 8088828..4a64c28 100644
--- a/tools/plot_lighthouse/main.c
+++ b/tools/plot_lighthouse/main.c
@@ -13,6 +13,11 @@
#include "glutil.h"
#include "fileutil.h"
+#ifdef LINUX
+#include <GL/freeglut.h>
+#endif
+
+
// Required to set up a window
#define WIDTH 800
#define HEIGHT 600
diff --git a/tools/process_rawcap/process_to_points.c b/tools/process_rawcap/process_to_points.c
index a1e835d..3ccfcc1 100644
--- a/tools/process_rawcap/process_to_points.c
+++ b/tools/process_rawcap/process_to_points.c
@@ -192,7 +192,8 @@ int main( int argc, char ** argv )
stddevtim += Sdiff * Sdiff;
stddevlen += Ldiff * Ldiff;
- Sdiff/=4;
+ //Cast a wider net for the histogram.
+ //Sdiff/=4;
int llm = Sdiff + (HISTOGRAMSIZE/2.0);
if( llm < 0 ) llm = 0;