diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-01-30 18:48:51 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2008-01-30 18:48:51 +0100 |
commit | 36993bfdca4fa91df4daedc3574dfb83ee3fb418 (patch) | |
tree | 0eb1065ea48136b610b5aca9e4a51d531f5d9ab4 | |
parent | d5059ba199339bc53ef5f56815a8491cb0b76a2a (diff) |
simplify Panorama::alpha()
-rw-r--r-- | src/Panorama.H | 2 | ||||
-rw-r--r-- | src/Panorama.cxx | 13 |
2 files changed, 7 insertions, 8 deletions
diff --git a/src/Panorama.H b/src/Panorama.H index 86bf447..d6fedcd 100644 --- a/src/Panorama.H +++ b/src/Panorama.H @@ -39,7 +39,7 @@ class Panorama { double distance(double phi, double lam); - double alpha(double phi, double lam); + double alpha(const Hill *m); double nick(Hill *m); diff --git a/src/Panorama.cxx b/src/Panorama.cxx index e5d7c5f..7d357f1 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -302,7 +302,7 @@ Panorama::update_angles() { m->dist = distance(m->phi, m->lam); if (m->phi != view_phi || m->lam != view_lam) { - m->alph = alpha(m->phi, m->lam); + m->alph = alpha(m); m->a_nick = nick(m); } } @@ -418,13 +418,12 @@ Panorama::distance(double phi, double lam) { } double -Panorama::alpha(double phi, double lam) { - double dist, sin_alph, cos_alph, alph; +Panorama::alpha(const Hill *m) { + double sin_alph, cos_alph; - dist = distance(phi, lam); - sin_alph = sin(lam - view_lam) * cos(phi) / sin(dist); - cos_alph = (sin(phi) - sin(view_phi) * cos(dist)) / - (cos(view_phi) * sin(dist)); + sin_alph = sin(m->lam - view_lam) * cos(m->phi) / sin(m->dist); + cos_alph = (sin(m->phi) - sin(view_phi) * cos(m->dist)) / + (cos(view_phi) * sin(m->dist)); return fmod(atan2(sin_alph, cos_alph) + 2.0 * pi_d, 2.0 * pi_d); } |