diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-01-02 21:13:41 +0100 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2007-01-02 21:13:41 +0100 |
commit | bf60d4709d662fb3c28458be8b11d58c8d9f654a (patch) | |
tree | 15ac752fb2447b16b6239044beebd149add2bd2d /src | |
parent | 06d4d841b7a84954bb3168cac6245a7eafc6f484 (diff) |
simplify alpha computation
Diffstat (limited to 'src')
-rw-r--r-- | src/Panorama.H | 4 | ||||
-rw-r--r-- | src/Panorama.cxx | 31 |
2 files changed, 4 insertions, 31 deletions
diff --git a/src/Panorama.H b/src/Panorama.H index 1658da5..c90d55e 100644 --- a/src/Panorama.H +++ b/src/Panorama.H @@ -39,10 +39,6 @@ class Panorama { double distance(double phi, double lam); - double sin_alpha(double lam, double phi, double c); - - double cos_alpha(double phi, double c); - double alpha(double phi, double lam); double nick(double dist, double height); diff --git a/src/Panorama.cxx b/src/Panorama.cxx index d5bfc62..c67b2e1 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -442,38 +442,15 @@ Panorama::distance(double phi, double lam) { } double -Panorama::sin_alpha(double lam, double phi, double c) { - return sin(lam - view_lam) * cos(phi) / sin(c); -} - - -double -Panorama::cos_alpha(double phi, double c) { - return (sin(phi) - sin(view_phi) * cos(c)) / (cos(view_phi) * sin(c)); -} - - -double Panorama::alpha(double phi, double lam) { double dist, sin_alph, cos_alph, alph; dist = distance(phi, lam); - sin_alph = sin_alpha(lam, phi, dist); - cos_alph = cos_alpha(phi, dist); - - if (sin_alph > 0) { - alph = acos(cos_alph); - } else { - alph = 2.0 * pi_d - acos(cos_alph); - } - + sin_alph = sin(lam - view_lam) * cos(phi) / sin(dist); + cos_alph = (sin(phi) - sin(view_phi) * cos(dist)) / + (cos(view_phi) * sin(dist)); - if (alph > 2.0 * pi_d) { - alph = alph - 2.0 * pi_d; - } else if (alph < 0.0) { - alph = alph + 2.0 * pi_d; - } - return alph; + return atan2(sin_alph, cos_alph); } |