diff options
Diffstat (limited to 'src')
-rw-r--r-- | src/GipfelWidget.cxx | 4 | ||||
-rw-r--r-- | src/Hill.H | 4 | ||||
-rw-r--r-- | src/Panorama.cxx | 20 | ||||
-rw-r--r-- | src/gipfel.cxx | 4 |
4 files changed, 20 insertions, 12 deletions
diff --git a/src/GipfelWidget.cxx b/src/GipfelWidget.cxx index b586240..faf70d1 100644 --- a/src/GipfelWidget.cxx +++ b/src/GipfelWidget.cxx @@ -1,5 +1,5 @@ // -// "$Id: GipfelWidget.cxx,v 1.5 2005/04/13 22:24:53 hofmann Exp $" +// "$Id: GipfelWidget.cxx,v 1.6 2005/04/14 19:54:58 hofmann Exp $" // // PSEditWidget routines. // @@ -94,7 +94,7 @@ GipfelWidget::draw() { } fl_line(center + m->x + x(), 0 + y(), center + m->x + x(), h() + y()); - fl_draw(m->name, center + m->x + x(), 20 + y() + (int) m->height / 6); + fl_draw(m->name, center + m->x + x(), 20 + y() + (int) m->height / 8); m = m->get_next_visible(); } @@ -1,5 +1,5 @@ // -// "$Id: Hill.H,v 1.3 2005/04/13 21:58:31 hofmann Exp $" +// "$Id: Hill.H,v 1.4 2005/04/14 19:54:58 hofmann Exp $" // // X11 header file for the Fast Light Tool Kit (FLTK). // @@ -35,6 +35,8 @@ class Mountain { double phi, lam; double height; double alph; + double a_view; + double distance; int x, y; char *name; diff --git a/src/Panorama.cxx b/src/Panorama.cxx index 995b5ec..256b07d 100644 --- a/src/Panorama.cxx +++ b/src/Panorama.cxx @@ -1,5 +1,5 @@ // -// "$Id: Panorama.cxx,v 1.4 2005/04/13 22:24:53 hofmann Exp $" +// "$Id: Panorama.cxx,v 1.5 2005/04/14 19:54:58 hofmann Exp $" // // PSEditWidget routines. // @@ -111,7 +111,7 @@ Panorama::get_visible_mountains() { int Panorama::get_x(Mountain *m) { - return (int) (tan(m->alph - a_center) * scale); + return (int) (tan(m->a_view) * scale); } int @@ -165,7 +165,7 @@ Panorama::get_pos(const char *name, double *phi, double *lam) { double p, l; while (m) { - if (strstr(m->name, name)) { + if (strcmp(m->name, name) == 0) { p = m->phi; l = m->lam; @@ -195,10 +195,16 @@ Panorama::update_visible_mountains() { > height_dist_ratio)) { m->alph = alpha(m->phi, m->lam); - - if (m->alph - a_center < pi / 2.0 && - m->alph - a_center > - pi / 2.0) { - // fprintf(stderr, "==> %s\n", m->name); + m->a_view = m->alph - a_center; + if (m->a_view > pi) { + m->a_view -= 2.0*pi; + } else if (m->a_view < -pi) { + m->a_view += 2.0*pi; + } + + // fprintf(stderr, "==> %s %f, dist %f km %f\n", m->name, m->alph, distance(m->phi, m->lam)* 6368, m->a_view); + if (m->a_view < pi / 2.0 && + m->a_view > - pi / 2.0) { m->x = get_x(m); m->clear_next_visible(); diff --git a/src/gipfel.cxx b/src/gipfel.cxx index 14c618c..4db18ae 100644 --- a/src/gipfel.cxx +++ b/src/gipfel.cxx @@ -1,5 +1,5 @@ // -// "$Id: gipfel.cxx,v 1.6 2005/04/13 22:24:53 hofmann Exp $" +// "$Id: gipfel.cxx,v 1.7 2005/04/14 19:54:58 hofmann Exp $" // // flpsed program. // @@ -155,7 +155,7 @@ int main(int argc, char** argv) { a->box(FL_THIN_DOWN_BOX); a->labelsize(10); a->step(0.0001); - a->bounds(-6.4, 6.4); + a->bounds(-3.14, 3.14); a->slider(FL_UP_BOX); a->callback((Fl_Callback*)angle_cb); Fl_Slider* r = new Fl_Slider(320, 30, 160, 15, "height-dist"); |