summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/ProjectionLSQ.H1
-rw-r--r--src/ProjectionLSQ.cxx10
-rw-r--r--src/Stitch.cxx2
-rw-r--r--src/lsq_rectilinear.mac29
4 files changed, 33 insertions, 9 deletions
diff --git a/src/ProjectionLSQ.H b/src/ProjectionLSQ.H
index 44cc91d..d937114 100644
--- a/src/ProjectionLSQ.H
+++ b/src/ProjectionLSQ.H
@@ -17,6 +17,7 @@ class ProjectionLSQ {
int lsq(const Hills *m, ViewParams *parms, int distortion_correct);
protected:
+ static double pi;
double sec(double a);
public:
diff --git a/src/ProjectionLSQ.cxx b/src/ProjectionLSQ.cxx
index cdf9f04..461f36e 100644
--- a/src/ProjectionLSQ.cxx
+++ b/src/ProjectionLSQ.cxx
@@ -17,7 +17,7 @@
#include "ProjectionLSQ.H"
-static double pi_d = asin(1.0) * 2.0;
+double ProjectionLSQ::pi = asin(1.0) * 2.0;
ProjectionLSQ::ProjectionLSQ() {
}
@@ -238,10 +238,10 @@ ProjectionLSQ::get_coordinates(double alph, double a_nick,
const ViewParams *parms, double *x, double *y) {
// Normalize alph - parms->a_center to [-pi/2, pi/2]
- if (alph - parms->a_center > pi_d) {
- alph -= 2.0 * pi_d;
- } else if (alph - parms->a_center < -pi_d) {
- alph += 2.0 * pi_d;
+ if (alph - parms->a_center > pi) {
+ alph -= 2.0 * pi;
+ } else if (alph - parms->a_center < -pi) {
+ alph += 2.0 * pi;
}
*x = mac_x(parms->a_center, parms->a_nick, parms->a_tilt, parms->scale,
diff --git a/src/Stitch.cxx b/src/Stitch.cxx
index e4f3d60..aa3798b 100644
--- a/src/Stitch.cxx
+++ b/src/Stitch.cxx
@@ -109,7 +109,7 @@ Stitch::resample(GipfelWidget::sample_mode_t m,
}
for (int y = 0; y < h; y++) {
- double a_nick = atan((double)(y_off - y)/radius);
+ double a_nick = (double)20.0 - y * step_view;
for (int x = 0; x < w; x++) {
double a_view;
diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac
index a06670d..e439d09 100644
--- a/src/lsq_rectilinear.mac
+++ b/src/lsq_rectilinear.mac
@@ -2,14 +2,37 @@
* rectilinear (pinhole) projection model with distortion correction
*/
+c_x : cos(m_nick) * cos(m_view-c_view)$
+c_y : cos(m_nick) * sin(m_view-c_view)$
+c_z : sin(m_nick)$
+
+/*
+c_x_rot1 : cos(c_view) * c_x - sin(c_view) * c_y$
+c_y_rot1 : sin(c_view) * c_x + cos(c_view) * c_y$
+c_z_rot1 : c_z$
+
+c_x_rot2 : c_x_rot1$
+c_y_rot2 : cos(c_nick) * c_y_rot1 - sin(c_nick) * c_z_rot1$
+c_z_rot2 : sin(c_nick) * c_y_rot1 - cos(c_nick) * c_z_rot1$
+
+c_x_rot2 : cos(c_nick) * c_x_rot1$ + sin(c_nick) * c_z_rot1$
+c_y_rot2 : c_y_rot1$
+c_z_rot2 : -sin(c_nick) * c_x_rot1 + cos(c_nick) * c_z_rot1$
+*/
+
+a_h : c_nick - (\pi/2 - acos(c_z))$
+a_v : atan(c_y / c_x)$
+
+
/* angle over horizon in view direction */
-a_h : atan (tan (m_nick) / cos(m_view - c_view))$
+/* a_h : atan (tan (m_nick) * sqrt(tan(m_view - c_view) ^2 + 1))$ */
/* adjust angle according to nick value */
-a_v : atan(cos(c_nick + a_h) * tan(m_view - c_view) / cos(a_h))$
+/* a_v : atan(cos(c_nick - a_h ) * tan((m_view - c_view) / cos(a_h)))$ */
+/* a_v : m_view - c_view$ */
x : tan(a_v)$
-y : tan(c_nick - a_h)$
+y : tan(a_h)$
x_rot : y * sin(c_tilt) + x * cos(c_tilt)+x0$
y_rot : y * cos(c_tilt) - x * sin(c_tilt)$
d : x_rot ^ 2 + y_rot ^ 2$