summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-12-12 17:31:53 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-12-12 17:31:53 +0100
commit22aee9c9e732253465ef8aaeaced8830348c0b47 (patch)
treef17cf267d9ee2683afdd7db3605e2e76d6bf06c8
parent241ddc04392fd7dd7b320624b34ad89a6de8c111 (diff)
updates
-rw-r--r--src/Makefile.lsq_funcs2
-rw-r--r--src/lsq_funcs.max28
2 files changed, 23 insertions, 7 deletions
diff --git a/src/Makefile.lsq_funcs b/src/Makefile.lsq_funcs
index 769d2b3..bbac7f7 100644
--- a/src/Makefile.lsq_funcs
+++ b/src/Makefile.lsq_funcs
@@ -1,4 +1,4 @@
all: lsq_funcs.c
lsq_funcs.c: lsq_funcs.max
- maxima -b lsq_funcs.max > lsq_funcs.c
+ maxima -b lsq_funcs.max | grep "^mac_" > lsq_funcs.c
diff --git a/src/lsq_funcs.max b/src/lsq_funcs.max
index 8875a4e..671aae2 100644
--- a/src/lsq_funcs.max
+++ b/src/lsq_funcs.max
@@ -1,12 +1,28 @@
-x_undist_unrot : TAN(m_view - c_view) * scale$
-y_undist_unrot : TAN(m_nick - c_nick) * scale$
+/*
+ * This is the basic pinhole projection model with distortion correction
+ */
+x_undist_unrot : tan(m_view - c_view) * scale$
+y_undist_unrot : tan(m_nick - c_nick) * scale$
d : y_undist_unrot ^ 2 + x_undist_unrot ^ 2$
dist_fact : d ^2 * k1 + d * k0$
x_unrot : x_undist_unrot * dist_fact$
y_unrot : y_undist_unrot * dist_fact$
-x : y_unrot * SIN(c_tilt) + x_unrot * COS(c_tilt)$
-y : y_unrot * COS(c_tilt) - x_unrot * SIN(c_tilt)$
+x : y_unrot * sin(c_tilt) + x_unrot * cos(c_tilt)$
+y : y_unrot * cos(c_tilt) - x_unrot * sin(c_tilt)$
+/*
+ * Some mangling for C code generation
+ */
x_expand : trigexpand(x)$
y_expand : trigexpand(y)$
-SPRINT("out_x = ", STRING(DIFF(x_expand, TAN(c_view))))$
-
+sprint("mac_x = ", string(subst(pow, "^", x_expand)))$
+sprint("mac_y = ", string(subst(pow, "^",y_expand)))$
+sprint("mac_x_dc_view = ", string(subst(pow, "^",diff(x_expand, c_view))))$
+sprint("mac_x_dc_nick = ", string(subst(pow, "^",diff(x_expand, c_nick))))$
+sprint("mac_x_dscale = ", string(subst(pow, "^",diff(x_expand, scale))))$
+sprint("mac_x_dk0 = ", string(subst(pow, "^",diff(x_expand, k0))))$
+sprint("mac_x_dk1 = ", string(subst(pow, "^",diff(x_expand, k1))))$
+sprint("mac_y_dc_view = ", string(subst(pow, "^",diff(y_expand, c_view))))$
+sprint("mac_y_dc_nick = ", string(subst(pow, "^",diff(y_expand, c_nick))))$
+sprint("mac_y_dscale = ", string(subst(pow, "^",diff(y_expand, scale))))$
+sprint("mac_y_dk0 = ", string(subst(pow, "^",diff(y_expand, k0))))$
+sprint("mac_y_dk1 = ", string(subst(pow, "^",diff(y_expand, k1))))$