diff options
author | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-04-01 13:16:44 +0200 |
---|---|---|
committer | Johannes Hofmann <Johannes.Hofmann@gmx.de> | 2009-04-01 13:16:44 +0200 |
commit | 9d8a88c1a46cc95f69e9bc0e50ed1134bef6c715 (patch) | |
tree | fa40a289a4fb129420c4c3099df0471c4236d9b4 /src/ProjectionCylindrical.cxx | |
parent | c368443056c0eda834f4924ca36c141d8d97f89e (diff) |
fix bug in cylindrical projection
If one peak is "left" and one is "right" of north, cylindrical
projection was not able to compute proper viewing parameters.
This is fixed by adjusting alpha angles of known hills to be increasing
with x.
Diffstat (limited to 'src/ProjectionCylindrical.cxx')
-rw-r--r-- | src/ProjectionCylindrical.cxx | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/src/ProjectionCylindrical.cxx b/src/ProjectionCylindrical.cxx index d41e5f8..094b494 100644 --- a/src/ProjectionCylindrical.cxx +++ b/src/ProjectionCylindrical.cxx @@ -1,5 +1,5 @@ // -// Copyright 2006 Johannes Hofmann <Johannes.Hofmann@gmx.de> +// Copyright 2006-2009 Johannes Hofmann <Johannes.Hofmann@gmx.de> // // This software may be used and distributed according to the terms // of the GNU General Public License, incorporated herein by reference. @@ -10,3 +10,17 @@ #include "ProjectionCylindrical.H" #include "ProjectionCylindrical_funcs.cxx" + +int +ProjectionCylindrical::comp_params(const Hills *h, ViewParams *parms) { + Hills h_monotone(h); + + h_monotone.sort(Hills::SORT_X); + + // ensure that alpha is increasing with x. + for (int i = 1; i < h_monotone.get_num(); i++) + if (h_monotone.get(i)->alph < h_monotone.get(i - 1)->alph) + h_monotone.get(i)->alph += asin(1.0) * 4.0; // += 2pi + + return ProjectionLSQ::comp_params(&h_monotone, parms); +} |