lilypond-1.1.60
authorfred <fred>
Tue, 26 Mar 2002 22:23:49 +0000 (22:23 +0000)
committerfred <fred>
Tue, 26 Mar 2002 22:23:49 +0000 (22:23 +0000)
lily/colhpos.cc
lily/encompass-info.cc
lily/slur.cc
ly/params.ly

index 8d82c2c06d1f58c2360e0f47c6af8c4c0e75d39f..f23646cb019b9bfb7a8f15e5dbd2e97fc229ecf1 100644 (file)
@@ -45,7 +45,7 @@ void
 Column_x_positions::OK() const
 {
 #ifndef NDEBUG
-  assert (config.size() == cols.size ());
+  assert (config_.size() == cols_.size ());
 #endif
 }
 
index b5fbcf56fee0af6136a908a75310ca618b182a7c..323fc20a9c5c8295bd0d38cae4cf5ace91c7a94c 100644 (file)
@@ -31,6 +31,7 @@ Encompass_info::Encompass_info (Note_column const* note_column, Direction dir, S
     {
       warning (_ ("Slur over rest?"));
       o_[X_AXIS] = note_column->hpos_f ();
+      o_[Y_AXIS] = note_column->extent (Y_AXIS)[dir];
       return; 
     }
   
@@ -42,9 +43,14 @@ Encompass_info::Encompass_info (Note_column const* note_column, Direction dir, S
 
   o_[X_AXIS] -= 0.5 * stem_l->dir_ * note_column->extent (X_AXIS).length ();
 
-  if (stem_l->dir_ == dir)
+  if ((stem_l->dir_ == dir)
+      && !stem_l->extent (Y_AXIS).empty_b ())
     {
       o_[Y_AXIS] = stem_l->extent (Y_AXIS)[dir];
+      // URG URG.
+      // some slur in choral.ly returns -inf here
+      if (abs (o_[Y_AXIS]) > 1000)
+       o_[Y_AXIS] = 0;
     }
   else
     {
index 5e8055a9f4bf737b1c7e175b8cd4287976640228..474712e8d59f677b8afd51d30914480ec78e1ee1 100644 (file)
@@ -134,7 +134,7 @@ Slur::do_post_processing ()
            side directly attached to note head;
            no beam getting in the way
          */
-         if (((stem_l->get_elt_property (transparent_scm_sym) != SCM_BOOL_F)
+         if ((stem_l->extent (Y_AXIS).empty_b ()
               || !((stem_l->dir_ == dir_) && (dir_ != d)))
              && !((dir_ == stem_l->dir_)
                   && stem_l->beam_l_ && (stem_l->beams_i_drul_[-d] >= 1)))
@@ -241,14 +241,6 @@ Slur::do_post_processing ()
   Real height_damp_f;
   Real slope_damp_f;
   Real snap_f;
-  Real ratio_f;
-
-  if (!fix_broken_b)
-    dy_f_drul_[RIGHT] += interstaff_f;
-  Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
-
-  Real dx_f = do_width ().length () + dx_f_drul_[RIGHT] - dx_f_drul_[LEFT];
-  Real height_f = do_height ().length ();
 
   if (!interstaff_b)
     {
@@ -263,6 +255,11 @@ Slur::do_post_processing ()
       snap_f = paper_l ()->get_var ("slur_interstaff_snap_to_stem");
     }
 
+  Real ratio_f;
+  if (!fix_broken_b)
+    dy_f_drul_[RIGHT] += interstaff_f;
+  Real dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
+  Real dx_f = do_width ().length () + dx_f_drul_[RIGHT] - dx_f_drul_[LEFT];
 
   /*
     Avoid too steep slurs.
@@ -273,26 +270,50 @@ Slur::do_post_processing ()
       Direction d = (Direction)(- dir_ * (sign (dy_f)));
       if (!d)
        d = LEFT;
-      dy_f_drul_[d] += dir_ * (ratio_f - slope_damp_f) * dx_f;
+      Real damp_f = (ratio_f - slope_damp_f) * dx_f;
+      /*
+       must never change sign of dy
+       */
+      damp_f = damp_f <? abs (dy_f);
+      dy_f_drul_[d] += dir_ * damp_f;
     }
 
   /*
    Avoid too high slurs 
+
+   Wierd slurs may look a lot better after they have been
+   adjusted a bit.
+   So, we'll do this in 3 steps
    */
-  ratio_f = abs (height_f / dx_f);
-  if (ratio_f > height_damp_f)
+  for (int i = 0; i < 3; i++)
     {
-      Direction d = (Direction)(- dir_ * (sign (dy_f)));
-      if (!d)
-       d = LEFT;
-      Real damp_f = dir_ * (ratio_f - height_damp_f) * dx_f;
-      dy_f_drul_[d] += damp_f;
-      /*
-       if y positions at about the same height, correct both ends
-       */
-      if (abs (dy_f / dx_f ) < slope_damp_f)
+      Real height_f = do_height ().length ();
+      dy_f = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
+
+      ratio_f = abs (height_f / dx_f);
+      if (ratio_f > height_damp_f)
        {
-         dy_f_drul_[-d] += damp_f;
+         Direction d = (Direction)(- dir_ * (sign (dy_f)));
+         if (!d)
+           d = LEFT;
+         /* take third step */
+         Real damp_f = (ratio_f - height_damp_f) * dx_f / 3;
+         /*
+           if y positions at about the same height, correct both ends
+         */
+         if (abs (dy_f / dx_f ) < slope_damp_f)
+           {
+             dy_f_drul_[-d] += dir_ * damp_f;
+             dy_f_drul_[d] += dir_ * damp_f;
+           }
+         /*
+           don't change slope too much, would have been catched by slope damping
+         */
+         else
+           {
+             damp_f = damp_f <? abs (dy_f/2);
+             dy_f_drul_[d] += dir_ * damp_f;
+           }
        }
     }
 
index 6f606819cfa97095a27e5b5131296daf3a666d65..8ac1cd2880441d14891aa9baaed38f71d5e15ed1 100644 (file)
@@ -92,11 +92,11 @@ slur_y_free = 0.75 * \interline;
 slur_x_minimum = 3.0 * \interline;
 
 % slope damping: keep dy/dx < slur_slope_damping
-slur_slope_damping = 0.3;
+slur_slope_damping = 0.35;
 slur_interstaff_slope_damping = 0.8;
 % height damping: keep h/dx < slur_height_damping
-slur_height_damping = 0.6;
-slur_interstaff_height_damping = 1.5;
+slur_height_damping = 0.45;
+slur_interstaff_height_damping = 1.2;
 % snap to stem if slur ends closer to stem than
 slur_snap_to_stem = 1.5 * \interline;
 slur_interstaff_snap_to_stem = 2.5 * \interline;
@@ -194,7 +194,8 @@ stemSpacingCorrection = 0.5*\interline;
 non_musical_space_strength = 40.0; 
 
 
-
+%If columns do not have spacing information set, set it to this much
+loose_column_distance = 2.0 * \interline;
 
 
 \include "engraver.ly";