]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/interval-minefield.cc
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / lily / interval-minefield.cc
index 79e17d97f9f6837526f49c654258658f903babb9..ddd79186ed63870489384c4c79edd3e793bc51e8 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2011--2012 Mike Solomon <mike@apollinemike.com>
+  Copyright (C) 2011--2015 Mike Solomon <mike@mikesolomon.org>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -19,7 +19,7 @@
 */
 
 #include "interval-minefield.hh"
-#include "grob.hh"
+
 Interval_minefield::Interval_minefield (Interval feasible_placements, Real bulk)
 {
   feasible_placements_ = feasible_placements;
@@ -38,18 +38,18 @@ Interval_minefield::feasible_placements ()
   return feasible_placements_;
 }
 
-  /*
-    forbidden_intervals_ contains a vector of intervals in which
-    the beam cannot start.  it iterates through these intervals,
-    pushing feasible_placements_ epsilon over or epsilon under a
-    collision.  when this type of change happens, the loop is marked
-    as "dirty" and re-iterated.
+/*
+  forbidden_intervals_ contains a vector of intervals in which
+  the beam cannot start.  it iterates through these intervals,
+  pushing feasible_placements_ epsilon over or epsilon under a
+  collision.  when this type of change happens, the loop is marked
+  as "dirty" and re-iterated.
 
-    TODO: figure out a faster ways that this loop can happen via
-    a better search algorithm.
-  */
+  TODO: figure out a faster ways that this loop can happen via
+  a better search algorithm.
+*/
 void
-Interval_minefield::solve()
+Interval_minefield::solve ()
 {
   Real epsilon = 1.0e-10;
   bool dirty = false;
@@ -58,8 +58,7 @@ Interval_minefield::solve()
       dirty = false;
       for (vsize i = 0; i < forbidden_intervals_.size (); i++)
         {
-          Direction d = DOWN;
-          do
+          for (DOWN_and_UP (d))
             {
               Interval feasible_widened = Interval (feasible_placements_[d], feasible_placements_[d]);
               feasible_widened.widen (bulk_ / 2.);
@@ -71,12 +70,11 @@ Interval_minefield::solve()
                        || feasible_widened.contains (forbidden_intervals_[i][d])
                        || feasible_widened.contains (forbidden_intervals_[i][-d]))
                 {
-                  feasible_placements_[d] = forbidden_intervals_[i][d] + d * (epsilon +  (bulk_ / 2));
+                  feasible_placements_[d] = forbidden_intervals_[i][d] + d * (epsilon + (bulk_ / 2));
                   dirty = true;
                 }
             }
-          while (flip (&d) != DOWN);
         }
     }
   while (dirty);
-}
\ No newline at end of file
+}