summaryrefslogtreecommitdiff
path: root/src/Hill.cxx
diff options
context:
space:
mode:
authorJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-04-01 13:16:44 +0200
committerJohannes Hofmann <Johannes.Hofmann@gmx.de>2009-04-01 13:16:44 +0200
commit9d8a88c1a46cc95f69e9bc0e50ed1134bef6c715 (patch)
treefa40a289a4fb129420c4c3099df0471c4236d9b4 /src/Hill.cxx
parentc368443056c0eda834f4924ca36c141d8d97f89e (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/Hill.cxx')
-rw-r--r--src/Hill.cxx20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/Hill.cxx b/src/Hill.cxx
index f45c197..b053568 100644
--- a/src/Hill.cxx
+++ b/src/Hill.cxx
@@ -242,6 +242,23 @@ comp_mountains_label_y(const void *n1, const void *n2) {
}
}
+static int
+comp_mountains_x(const void *n1, const void *n2) {
+ Hill *m1 = *(Hill **)n1;
+ Hill *m2 = *(Hill **)n2;
+
+ if (m1 && m2) {
+ if (m2->x < m1->x)
+ return 1;
+ else if (m2->x > m1->x)
+ return -1;
+ else
+ return 0;
+ } else {
+ return 0;
+ }
+}
+
void
Hills::sort(SortType t) {
int (*cmp)(const void *, const void *);
@@ -262,6 +279,9 @@ Hills::sort(SortType t) {
case SORT_LABEL_Y:
cmp = comp_mountains_label_y;
break;
+ case SORT_X:
+ cmp = comp_mountains_x;
+ break;
default:
fprintf(stderr, "ERROR: Unknown sort type %d\n", t);
return;