aboutsummaryrefslogtreecommitdiff
path: root/tools/lighthousefind_tori/torus_localizer.c
diff options
context:
space:
mode:
authorMike Turvey <mturvey6@gmail.com>2017-02-07 00:11:39 -0700
committerMike Turvey <mturvey6@gmail.com>2017-02-07 00:28:20 -0700
commita4cf0b14abb17c313243d0fb84555aec2cef61a0 (patch)
tree8064d9258b3b8c387e8e0e19518efc61caaf6eec /tools/lighthousefind_tori/torus_localizer.c
parent7ea248577178f45033802ba5cc2867f8a66d69f8 (diff)
downloadlibsurvive-a4cf0b14abb17c313243d0fb84555aec2cef61a0.tar.gz
libsurvive-a4cf0b14abb17c313243d0fb84555aec2cef61a0.tar.bz2
Merging math libraries
Diffstat (limited to 'tools/lighthousefind_tori/torus_localizer.c')
-rw-r--r--tools/lighthousefind_tori/torus_localizer.c19
1 files changed, 11 insertions, 8 deletions
diff --git a/tools/lighthousefind_tori/torus_localizer.c b/tools/lighthousefind_tori/torus_localizer.c
index 58e4938..f3040cd 100644
--- a/tools/lighthousefind_tori/torus_localizer.c
+++ b/tools/lighthousefind_tori/torus_localizer.c
@@ -2,16 +2,24 @@
#include <stdlib.h>
#include <assert.h>
#include <stdio.h>
+#include "linmath.h"
#include "tori_includes.h"
-#include "find_tori_math.h"
#include "visualization.h"
+static double distance(Point a, Point b)
+{
+ double x = a.x - b.x;
+ double y = a.y - b.y;
+ double z = a.z - b.z;
+ return sqrt(x*x + y*y + z*z);
+}
+
Matrix3x3 GetRotationMatrixForTorus(Point a, Point b)
{
Matrix3x3 result;
- double v1[3] = { 0, 0, 1 };
- double v2[3] = { a.x - b.x, a.y - b.y, a.z - b.z };
+ FLT v1[3] = { 0, 0, 1 };
+ FLT v2[3] = { a.x - b.x, a.y - b.y, a.z - b.z };
normalize_v3(v2);
@@ -25,11 +33,6 @@ Point RotateAndTranslatePoint(Point p, Matrix3x3 rot, Point newOrigin)
Point q;
double pf[3] = { p.x, p.y, p.z };
- //float pq[3];
-
- //q.x = rot.val[0][0] * p.x + rot.val[0][1] * p.y + rot.val[0][2] * p.z + newOrigin.x;
- //q.y = rot.val[1][0] * p.x + rot.val[1][1] * p.y + rot.val[1][2] * p.z + newOrigin.y;
- //q.z = rot.val[2][0] * p.x + rot.val[2][1] * p.y + rot.val[2][2] * p.z + newOrigin.z;
q.x = rot.val[0][0] * p.x + rot.val[1][0] * p.y + rot.val[2][0] * p.z + newOrigin.x;
q.y = rot.val[0][1] * p.x + rot.val[1][1] * p.y + rot.val[2][1] * p.z + newOrigin.y;
q.z = rot.val[0][2] * p.x + rot.val[1][2] * p.y + rot.val[2][2] * p.z + newOrigin.z;