From bf707a03756021f69e3f5d1a8246639a6a601099 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Thu, 14 Apr 2011 23:45:51 -0300 Subject: [PATCH] Use distance to original point rather than size of allowed region for tie-breaking. Add regression test. --- input/regression/beam-collision-large-object.ly | 15 +++++++++++++++ lily/beam.cc | 5 +++-- 2 files changed, 18 insertions(+), 2 deletions(-) create mode 100644 input/regression/beam-collision-large-object.ly diff --git a/input/regression/beam-collision-large-object.ly b/input/regression/beam-collision-large-object.ly new file mode 100644 index 0000000000..a3dd1dcf44 --- /dev/null +++ b/input/regression/beam-collision-large-object.ly @@ -0,0 +1,15 @@ +\header { + texidoc = "Behave sensibly in the presence of large collisions." +} + +\version "2.13.59" +\new Staff { + << + { \voiceOne s2 } + \\ + { \voiceTwo e4 e } + \\ + { \voiceFour + f''8[ e'' a'' g''] } + >> +} diff --git a/lily/beam.cc b/lily/beam.cc index f39bf9f62c..6845b1346b 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -1303,9 +1303,10 @@ Beam::shift_region_to_valid (SCM grob, SCM posns) || !collision_free[UP].is_empty ()) { // We have space above or below collisions (or, no collisions at - // all). + // all). Should we factor in the size of the collision_free + // interval as well? Interval best = - (collision_free[DOWN].length () > collision_free[UP].length ()) ? + (collision_free[DOWN].distance(beam_left_y) < collision_free[UP].distance (beam_left_y)) ? collision_free[DOWN] : collision_free[UP]; beam_left_y = point_in_interval (best, 2.0); -- 2.39.2