From 3fa72f4b765457ce369d1aa1495dc36c90a94ebf Mon Sep 17 00:00:00 2001 From: ultramn Date: Wed, 8 Mar 2017 21:03:05 -0800 Subject: Added OrthoSolve, it works great! --- dave/AffineSolve.c | 478 +++++++++++++++++++++++++++++++++++++++++++---------- 1 file changed, 395 insertions(+), 83 deletions(-) (limited to 'dave') diff --git a/dave/AffineSolve.c b/dave/AffineSolve.c index 36587e6..1eaf633 100644 --- a/dave/AffineSolve.c +++ b/dave/AffineSolve.c @@ -1,7 +1,6 @@ // // main.c -// AffineSolve -// +// Aff // Created by user on 3/2/17. // Copyright © 2017 user. All rights reserved. // @@ -10,10 +9,24 @@ #include #include #include +#include "dclapack.h" #define LH_ID 0 #define NUM_HMD 32 +#define MAX_POINTS 128 +//#define _ABS(a) ( (a)<=0 ? -(a) : (a) ) +#define _SIGN(a) ( (a)<=0 ? -1.0f : 1.0f ) +#define RANDF ( (float)rand() / (float)RAND_MAX ) +#define PI 3.14159265358979323846264 + +#define STEP_SIZE_ROT 1.0 +#define STEP_SIZE_POS 1.0 +#define FALLOFF 0.99999 +#define NITER 2000000 +#define TOO_SMALL 0.0001 +#define ORTHOG_PENALTY 1.0 + float hmd_pos[NUM_HMD][3]; void ReadHmdPoints() { @@ -31,17 +44,35 @@ void ReadHmdPoints() fclose(fin); } -#define MAX_POINTS 128 -#define _ABS(a) ( (a)<=0 ? -(a) : (a) ) -#define _SIGN(a) ( (a)<=0 ? -1.0f : 1.0f ) -#define RANDF ( (float)rand() / (float)RAND_MAX ) +float hmd_angle[NUM_HMD][2]; +void ReadPtinfo() +{ + // Initialize to -9999 + int i; + for (i=0; i 0 && err < bestErr) { x[1][0]=x_y; y[1][0]=y_y; z[1][0]=z_y; bestErr=err; } + z_y = -z_y; + } + y_y = -y_y; + } + x_y = -x_y; + } + printf("bestErr %f\n", bestErr); + + for (i=0; i