From 7d900b4ede22215413e4a0ddd1675c650ba3225f Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 11:49:32 +0200 Subject: implement various helper methods --- src/Panorama.cxx | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'src/Panorama.cxx') diff --git a/src/Panorama.cxx b/src/Panorama.cxx index c8cb1dc..55fb9b8 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -586,3 +586,18 @@ Panorama::get_real_distance(Hill *m) { return c; } +int +Panorama::get_coordinates(double a_view, double a_nick, int *x, int *y) { + Hill *m = new Hill(0,0); + + m->a_view = a_view; + m->a_nick = a_nick; + + proj->set_coordinates(m, &parms); + + *x = m->x; + *y = m->y; + + return 0; +} + -- cgit v1.2.3 From bf376cf0a996b08c39f22d46ba68be4e7957777f Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 13:02:31 +0200 Subject: first working version --- src/Panorama.cxx | 25 +++++++++++++++++++------ 1 file changed, 19 insertions(+), 6 deletions(-) (limited to 'src/Panorama.cxx') diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 55fb9b8..b33a260 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -588,15 +588,28 @@ Panorama::get_real_distance(Hill *m) { int Panorama::get_coordinates(double a_view, double a_nick, int *x, int *y) { - Hill *m = new Hill(0,0); + Hill m(0,0); - m->a_view = a_view; - m->a_nick = a_nick; - proj->set_coordinates(m, &parms); - *x = m->x; - *y = m->y; + m.a_view = a_view - parms.a_center; + + if (m.a_view > pi_d) { + m.a_view -= 2.0*pi_d; + } else if (m.a_view < -pi_d) { + m.a_view += 2.0*pi_d; + } + + if (m.a_view < view_angle && m.a_view > - view_angle) { + return 1; + } + + m.a_nick = a_nick; + + proj->set_coordinates(&m, &parms); + + *x = m.x; + *y = m.y; return 0; } -- cgit v1.2.3 From 88555db930fc170f97ebbca6c17802392a5b5f25 Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Sun, 25 Jun 2006 13:51:38 +0200 Subject: show stitching online --- src/Panorama.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'src/Panorama.cxx') diff --git a/src/Panorama.cxx b/src/Panorama.cxx index b33a260..a644732 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -593,17 +593,17 @@ Panorama::get_coordinates(double a_view, double a_nick, int *x, int *y) { m.a_view = a_view - parms.a_center; - + if (m.a_view > pi_d) { m.a_view -= 2.0*pi_d; } else if (m.a_view < -pi_d) { m.a_view += 2.0*pi_d; } - if (m.a_view < view_angle && m.a_view > - view_angle) { + if (m.a_view > view_angle || m.a_view < - view_angle) { return 1; } - + m.a_nick = a_nick; proj->set_coordinates(&m, &parms); -- cgit v1.2.3 From 70a6e7c52eb8830e7e2c5884247201defdeb6a1c Mon Sep 17 00:00:00 2001 From: Johannes Hofmann Date: Mon, 26 Jun 2006 18:05:47 +0200 Subject: switch to double coordinates --- src/Panorama.cxx | 30 ++++++++++++------------------ 1 file changed, 12 insertions(+), 18 deletions(-) (limited to 'src/Panorama.cxx') diff --git a/src/Panorama.cxx b/src/Panorama.cxx index a644732..73bc003 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -508,8 +508,11 @@ Panorama::update_coordinates() { for (int i=0; iget_num(); i++) { m = visible_mountains->get(i); + double tmp_x, tmp_y; - proj->set_coordinates(m, &parms); + proj->get_coordinates(m->a_view, m->a_nick, &parms, &tmp_x, &tmp_y); + m->x = (int) rint(tmp_x); + m->y = (int) rint(tmp_y); } } @@ -587,29 +590,20 @@ Panorama::get_real_distance(Hill *m) { } int -Panorama::get_coordinates(double a_view, double a_nick, int *x, int *y) { - Hill m(0,0); +Panorama::get_coordinates(double a_view, double a_nick, double *x, double *y) { + a_view = a_view - parms.a_center; - - - m.a_view = a_view - parms.a_center; - - if (m.a_view > pi_d) { - m.a_view -= 2.0*pi_d; - } else if (m.a_view < -pi_d) { - m.a_view += 2.0*pi_d; + if (a_view > pi_d) { + a_view -= 2.0*pi_d; + } else if (a_view < -pi_d) { + a_view += 2.0*pi_d; } - if (m.a_view > view_angle || m.a_view < - view_angle) { + if (a_view > view_angle || a_view < - view_angle) { return 1; } - m.a_nick = a_nick; - - proj->set_coordinates(&m, &parms); - - *x = m.x; - *y = m.y; + proj->get_coordinates(a_view, a_nick, &parms, x, y); return 0; } -- cgit v1.2.3