From: Keith OHara Date: Sat, 24 Aug 2013 06:38:08 +0000 (-0700) Subject: skyline: comments to warn of potential endless loop X-Git-Tag: release/2.17.26-1~18^2~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=150745273341e59d16a3e6705071879be4e615b6;p=lilypond.git skyline: comments to warn of potential endless loop --- diff --git a/lily/skyline.cc b/lily/skyline.cc index 70bf989861..a462015866 100644 --- a/lily/skyline.cc +++ b/lily/skyline.cc @@ -175,7 +175,9 @@ Building::shift_to_intersect (Real x, Real y) const } static Real -first_intersection (Building const &b, list *const s, Real start_x) +first_intersection (Building const &b, list *s, Real start_x) +/* Return the first x >= start_x where skyline s above Building b. + * Removes buildings from s that are concealed by b. */ { while (!s->empty () && start_x < b.end_) { @@ -305,7 +307,7 @@ Skyline::internal_merge_skyline (list *s1, list *s2, last_end = x; continue; } - + // first_intersection() removes buildings from s2 if b hides them Real end = first_intersection (b, s2, x); if (s2->empty ()) { @@ -314,6 +316,8 @@ Skyline::internal_merge_skyline (list *s1, list *s2, break; } + // Should be (end > x), during ver2.19. end == x happens fairly often, + // and we do not need to keep vertical segments within a skyline. if (end >= x) { b.leading_part (end); @@ -324,6 +328,9 @@ Skyline::internal_merge_skyline (list *s1, list *s2, if (end >= s1->front ().end_) s1->pop_front (); + // Should add during ver2.19 (to avoid an endless loop + // when merging identical skylines with a vertical segment) + // if (end >= s2->front().end_) s2->pop_front(); x = end; }