lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Gets rid of unnecessary logic in beam.cc. (issue4449065)


From: mtsolo
Subject: Gets rid of unnecessary logic in beam.cc. (issue4449065)
Date: Thu, 28 Apr 2011 15:37:53 +0000

Reviewers: ,

Message:
If I understand it correctly, Han-Wen's original collision code in
beam.cc was treating intervals as if is_empty checked if they were
uninitialized or invalid in some way, whereas in fact, is_empty gets rid
of anything where left is greater than right.  However, the LEFT and
RIGHT values of intervals in collision_free contain y values for the
beam position, and thus, the left one will invariably be higher than the
right one if the beam has a negative slope.  Thus, is_empty was (I
think) ruling out any solution with a negative slope.

I'm not sure if this is too drastic to address issue 1613 (there may
need to be some error checking fit in), but I think that it more or less
fixes the problem.

Description:
Gets rid of unnecessary logic in beam.cc.

Please review this at http://codereview.appspot.com/4449065/

Affected files:
  M lily/beam.cc


Index: lily/beam.cc
diff --git a/lily/beam.cc b/lily/beam.cc
index 938567984ecc81f2b96889bec0c0432c0f99e09c..3acc55682e7a28ce1d2554cb74d4d96ee8ca94bb 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -1308,18 +1308,7 @@ Beam::shift_region_to_valid (SCM grob, SCM posns)
     {
       // We're good to go. Do nothing.
     }
- else if (collision_free[DOWN].is_empty() != collision_free[UP].is_empty())
-    {
-      // Only one of them offers is feasible solution. Pick that one.
-      Interval v =
-        (!collision_free[DOWN].is_empty()) ?
-        collision_free[DOWN] :
-        collision_free[UP];
-
-      beam_left_y = point_in_interval (v, 2.0);
-    }
-  else if (!collision_free[DOWN].is_empty ()
-           && !collision_free[UP].is_empty ())
+  else
     {
       // Above and below are candidates, take the one closest to the
       // starting solution.
@@ -1330,17 +1319,6 @@ Beam::shift_region_to_valid (SCM grob, SCM posns)

       beam_left_y = point_in_interval (best, 2.0);
     }
-  else if (!feasible_left_point.is_empty ())
-    {
-      // We are somewhat screwed: we have a collision, but at least
-      // there is a way to satisfy stem length constraints.
-      beam_left_y = point_in_interval (feasible_left_point, 2.0);
-    }
-  else
-    {
-      // We are completely screwed.
- me->warning (_ ("no viable initial configuration found: may not find good beam slope"));
-    }

   pos = Drul_array<Real> (beam_left_y, (beam_left_y + beam_dy));
   scale_drul (&pos, 1 / Staff_symbol_referencer::staff_space (me));





reply via email to

[Prev in Thread] Current Thread [Next in Thread]