summaryrefslogtreecommitdiff
path: root/src/lsq_rectilinear.mac
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-12-17 16:13:32 +0100
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2006-12-17 16:13:32 +0100
commit23900d0b19e5c978934108f6a54aa82f6c7f27cb (patch)
tree33008c888e2205c32296272c5e766d292233a212 /src/lsq_rectilinear.mac
parent6ee81353d9dd4a9a97f8e91d6a619e59808f8106 (diff)
use LSQ for all projection types
Diffstat (limited to 'src/lsq_rectilinear.mac')
-rw-r--r--src/lsq_rectilinear.mac40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac
new file mode 100644
index 0000000..662680a
--- /dev/null
+++ b/src/lsq_rectilinear.mac
@@ -0,0 +1,40 @@
+/*
+ * This is the basic pinhole projection model with distortion correction
+ */
+
+x : tan(m_view - c_view)$
+y : tan(c_nick - m_nick)$
+x_rot : y * sin(c_tilt) + x * cos(c_tilt)$
+y_rot : y * cos(c_tilt) - x * sin(c_tilt)$
+d : x_rot ^ 2 + y_rot ^ 2$
+dist_fact : d ^ 2 * k1 + d * k0$
+x_dist : x_rot * (1 + dist_fact) * scale$
+y_dist : y_rot * (1 + dist_fact) * scale$
+
+/*
+ * Some mangling for C code generation
+ */
+
+x_expand : trigexpand(x_dist)$
+y_expand : trigexpand(y_dist)$
+
+args: "(double c_view, double c_nick, double c_tilt, double scale, double k0, double k1, double m_view, double m_nick)"$
+
+printfunc(name, expression) := sprint("double ProjectionRectilinear::", name, args, "{ return ", string(subst(pow, "^", expression)), ";}", "
+")$
+
+printfunc("mac_x", x_expand)$
+printfunc("mac_y", y_expand)$
+
+printfunc("mac_x_dc_view", diff(x_expand, c_view))$
+printfunc("mac_x_dc_nick", diff(x_expand, c_nick))$
+printfunc("mac_x_dc_tilt", diff(x_expand, c_tilt))$
+printfunc("mac_x_dscale", diff(x_expand, scale))$
+printfunc("mac_x_dk0", diff(x_expand, k0))$
+printfunc("mac_x_dk1", diff(x_expand, k1))$
+printfunc("mac_y_dc_view", diff(y_expand, c_view))$
+printfunc("mac_y_dc_nick", diff(y_expand, c_nick))$
+printfunc("mac_y_dc_tilt", diff(y_expand, c_tilt))$
+printfunc("mac_y_dscale", diff(y_expand, scale))$
+printfunc("mac_y_dk0", diff(y_expand, k0))$
+printfunc("mac_y_dk1", diff(y_expand, k1))$