From bc36079638b4ff3d0b7b3476dc5125bb1fc38c91 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Fri, 2 May 2008 15:48:58 +0200 Subject: fix rectilinear projection --- src/lsq_rectilinear.mac | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index 5bd7ac9..d1abf4e 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -2,8 +2,11 @@ * rectilinear (pinhole) projection model with distortion correction */ -x : tan(m_view - c_view)$ -y : tan(c_nick - m_nick)$ +a_v : m_view - c_view$ +a_h : c_nick - atan (tan (m_nick) / cos(a_v))$ + +x : tan(a_v)$ +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$ -- cgit v1.2.3 From d9c027bb9b4bfb74c41c334fc8cf889d4e244b55 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 18 May 2008 19:26:16 +0200 Subject: further rectiliear projection correction --- src/lsq_rectilinear.mac | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index d1abf4e..a06670d 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -2,11 +2,14 @@ * rectilinear (pinhole) projection model with distortion correction */ -a_v : m_view - c_view$ -a_h : c_nick - atan (tan (m_nick) / cos(a_v))$ +/* angle over horizon in view direction */ +a_h : atan (tan (m_nick) / cos(m_view - c_view))$ + +/* adjust angle according to nick value */ +a_v : atan(cos(c_nick + a_h) * tan(m_view - c_view) / cos(a_h))$ x : tan(a_v)$ -y : tan(a_h)$ +y : tan(c_nick - 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$ -- cgit v1.2.3 From 7669bc038012eb92bd8d3ae842b236cd406ed074 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 21 May 2008 19:47:10 +0200 Subject: rotate in cartesian coordinates --- src/lsq_rectilinear.mac | 29 ++++++++++++++++++++++++++--- 1 file changed, 26 insertions(+), 3 deletions(-) (limited to 'src/lsq_rectilinear.mac') 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$ -- cgit v1.2.3 From 4f544f1ab0d04a4b18fac5e9bec0e869b981f038 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 21 May 2008 19:58:47 +0200 Subject: fixes to cartesian rotation --- src/lsq_rectilinear.mac | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index e439d09..bd0a4f9 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -14,25 +14,25 @@ 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)$ +c_x_rot : cos(c_nick) * c_x$ + sin(c_nick) * c_z$ +c_y_rot : c_y$ +c_z_rot : -sin(c_nick) * c_x + cos(c_nick) * c_z$ + +a_h : (\pi/2 - acos(c_z_rot))$ +a_v : atan(c_y_rot / c_x_rot)$ /* angle over horizon in view direction */ -/* a_h : atan (tan (m_nick) * sqrt(tan(m_view - c_view) ^2 + 1))$ */ +a_h_dir : atan (tan (a_h) * sqrt(tan(a_v) ^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 : m_view - c_view$ */ x : tan(a_v)$ -y : tan(a_h)$ +y : tan(-a_h_dir)$ 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$ -- cgit v1.2.3 From d98e0c7977a5872bf3f32926b75ef7df14090b7e Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Wed, 21 May 2008 20:35:29 +0200 Subject: add comments --- src/lsq_rectilinear.mac | 23 ++++++----------------- 1 file changed, 6 insertions(+), 17 deletions(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index bd0a4f9..cea35e1 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -2,39 +2,28 @@ * 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)$ +/* switch to cartesian coordinates for nick rotation */ +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_rot : cos(c_nick) * c_x$ + sin(c_nick) * c_z$ c_y_rot : c_y$ c_z_rot : -sin(c_nick) * c_x + cos(c_nick) * c_z$ +/* back to spheric coordinates */ a_h : (\pi/2 - acos(c_z_rot))$ a_v : atan(c_y_rot / c_x_rot)$ - /* angle over horizon in view direction */ a_h_dir : atan (tan (a_h) * sqrt(tan(a_v) ^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 : m_view - c_view$ */ - x : tan(a_v)$ y : tan(-a_h_dir)$ x_rot : y * sin(c_tilt) + x * cos(c_tilt)+x0$ y_rot : y * cos(c_tilt) - x * sin(c_tilt)$ + +/* distortion correction */ d : x_rot ^ 2 + y_rot ^ 2$ dist_fact : d ^ 2 * k1 + d * k0$ x_dist : x_rot * (1 + dist_fact) * scale$ -- cgit v1.2.3 From f35a69d7bfb469f664735a1499d7eb553cdd597f Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Thu, 22 May 2008 16:47:56 +0200 Subject: comments and whitespace --- src/lsq_rectilinear.mac | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index cea35e1..3c5b367 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -7,12 +7,13 @@ 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)$ +/* nick rotation */ c_x_rot : cos(c_nick) * c_x$ + sin(c_nick) * c_z$ c_y_rot : c_y$ c_z_rot : -sin(c_nick) * c_x + cos(c_nick) * c_z$ -/* back to spheric coordinates */ -a_h : (\pi/2 - acos(c_z_rot))$ +/* back to spherical coordinates */ +a_h : \pi / 2 - acos(c_z_rot)$ a_v : atan(c_y_rot / c_x_rot)$ /* angle over horizon in view direction */ -- cgit v1.2.3 From bac85749b75971ee75d635bea3117f8a4f640e1c Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sat, 24 May 2008 00:08:29 +0200 Subject: major simplification of rectilinear projection --- src/lsq_rectilinear.mac | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index 3c5b367..4ed1e09 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -12,15 +12,8 @@ c_x_rot : cos(c_nick) * c_x$ + sin(c_nick) * c_z$ c_y_rot : c_y$ c_z_rot : -sin(c_nick) * c_x + cos(c_nick) * c_z$ -/* back to spherical coordinates */ -a_h : \pi / 2 - acos(c_z_rot)$ -a_v : atan(c_y_rot / c_x_rot)$ - -/* angle over horizon in view direction */ -a_h_dir : atan (tan (a_h) * sqrt(tan(a_v) ^2 + 1))$ - -x : tan(a_v)$ -y : tan(-a_h_dir)$ +x : c_y_rot / c_x_rot$ +y : - c_z_rot / c_x_rot$ x_rot : y * sin(c_tilt) + x * cos(c_tilt)+x0$ y_rot : y * cos(c_tilt) - x * sin(c_tilt)$ -- cgit v1.2.3 From d417ed2632eb97f133347db2201da447632a3dc9 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sat, 24 May 2008 00:13:08 +0200 Subject: comments --- src/lsq_rectilinear.mac | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index 4ed1e09..8e0c0f3 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -2,7 +2,7 @@ * rectilinear (pinhole) projection model with distortion correction */ -/* switch to cartesian coordinates for nick rotation */ +/* switch to cartesian coordinates */ 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)$ @@ -12,8 +12,11 @@ c_x_rot : cos(c_nick) * c_x$ + sin(c_nick) * c_z$ c_y_rot : c_y$ c_z_rot : -sin(c_nick) * c_x + cos(c_nick) * c_z$ +/* pinhole projection */ x : c_y_rot / c_x_rot$ y : - c_z_rot / c_x_rot$ + +/* rotation around view axis */ x_rot : y * sin(c_tilt) + x * cos(c_tilt)+x0$ y_rot : y * cos(c_tilt) - x * sin(c_tilt)$ -- cgit v1.2.3 From a550b880fb9a28cba8ce0aa351444f1ef8ee8958 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 May 2008 18:12:50 +0200 Subject: fix stupid typo --- src/lsq_rectilinear.mac | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index 8e0c0f3..68dc5ee 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -8,7 +8,7 @@ c_y : cos(m_nick) * sin(m_view - c_view)$ c_z : sin(m_nick)$ /* nick rotation */ -c_x_rot : cos(c_nick) * c_x$ + sin(c_nick) * c_z$ +c_x_rot : cos(c_nick) * c_x + sin(c_nick) * c_z$ c_y_rot : c_y$ c_z_rot : -sin(c_nick) * c_x + cos(c_nick) * c_z$ -- cgit v1.2.3 From 090788ca04d1620c258d3a1e9053b907e87ec3c1 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Tue, 27 May 2008 18:43:14 +0200 Subject: whitespace --- src/lsq_rectilinear.mac | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'src/lsq_rectilinear.mac') diff --git a/src/lsq_rectilinear.mac b/src/lsq_rectilinear.mac index 68dc5ee..377c24a 100644 --- a/src/lsq_rectilinear.mac +++ b/src/lsq_rectilinear.mac @@ -14,10 +14,10 @@ c_z_rot : -sin(c_nick) * c_x + cos(c_nick) * c_z$ /* pinhole projection */ x : c_y_rot / c_x_rot$ -y : - c_z_rot / c_x_rot$ +y : -c_z_rot / c_x_rot$ /* rotation around view axis */ -x_rot : y * sin(c_tilt) + x * cos(c_tilt)+x0$ +x_rot : y * sin(c_tilt) + x * cos(c_tilt) + x0$ y_rot : y * cos(c_tilt) - x * sin(c_tilt)$ /* distortion correction */ -- cgit v1.2.3