]> git.donarmstrong.com Git - lilypond.git/commitdiff
fix thinko in computation of average force.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 20 May 2007 21:07:30 +0000 (18:07 -0300)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 20 May 2007 21:07:30 +0000 (18:07 -0300)
lily/optimal-page-breaking.cc

index a0ba883396d5874e0f7cd397660c2ac166b3b9eb..f25d75f039ca3a9cebeb3779c8f57fba1bf2f217 100644 (file)
@@ -44,9 +44,9 @@ Optimal_page_breaking::solve ()
   message (_ ("Finding the ideal number of pages..."));
   set_to_ideal_line_configuration (0, end);
   
-  Line_division ideal_line_division = current_configuration (0);
   Page_spacing_result best = space_systems_on_best_pages (0, first_page_num);
   vsize page_count = best.systems_per_page_.size ();
+  Line_division ideal_line_division = current_configuration (0);
   Line_division best_division = ideal_line_division;
 
   vsize ideal_sys_count = best.system_count ();
@@ -95,10 +95,12 @@ Optimal_page_breaking::solve ()
       if (best_for_this_sys_count.systems_per_page_.size () < page_count)
        {
          /* if the pages are stretched on average, stop trying to reduce sys_count */
-         Real avg_f = 0;
+         Real average_force = 0;
          for (vsize i = 0; i < best_for_this_sys_count.systems_per_page_.size (); i++)
-           avg_f += best_for_this_sys_count.systems_per_page_[i];
-         if (avg_f > 0)
+           average_force += best_for_this_sys_count.force_[i];
+
+         average_force /= best_for_this_sys_count.page_count (); 
+         if (average_force > 0)
            break;
        }