lilypond-devel
[Top][All Lists]
Advanced

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

Re: Make sure slurs actually avoid stafflines. (issue 15400049)


From: k-ohara5a5a
Subject: Re: Make sure slurs actually avoid stafflines. (issue 15400049)
Date: Tue, 12 Nov 2013 01:27:33 +0000

I suggest making the minimal changes to the structure of the old code
(plus whatever comments you like) that make the change we all want in in
behavior.


https://codereview.appspot.com/15400049/diff/120001/lily/slur-configuration.cc
File lily/slur-configuration.cc (left):

https://codereview.appspot.com/15400049/diff/120001/lily/slur-configuration.cc#oldcode45
lily/slur-configuration.cc:45: {
      Real t = ts[0];
      Real y = bez.curve_point (t)[Y_AXIS];

      Grob *staff = state.extremes_[LEFT].staff_;

      Real p = 2 * (y - staff->relative_coordinate
(state.common_[Y_AXIS], Y_AXIS))
               / state.staff_space_;

      Real const round = my_round (p);
      Real const frac = p - round;
      Real min_separation = 0.5 * state.thickness_
        + (frac * state.dir_ > 0.0)
          ? state.parameters_.min_gap_inside_
          : state.parameters_.min_gap_outside_;

      if (fabs (frac) < 2 * min_separation
          && Staff_symbol_referencer::on_staff_line (staff, int
(round)))
        {
          Direction resolution_dir = (frac > 0.0) ? UP : DOWN;

          Real newp = round + resolution_dir * min (1.0, 2 *
min_separation);

          Real dy = (newp - p) * state.staff_space_ / 2.0;

          bez.control_[1][Y_AXIS] += dy;
          bez.control_[2][Y_AXIS] += dy;

          // The horizontal part of the curve moves 3t-3t² as far
          // as the middle control-points, so the remaining correction
is:
          dy -= dy * 3.0 * t * (1.0 - t);

          bez.control_[0][Y_AXIS] += dy;
          bez.control_[1][Y_AXIS] += dy;
          bez.control_[2][Y_AXIS] += dy;
          bez.control_[3][Y_AXIS] += dy;
        }

https://codereview.appspot.com/15400049/

reply via email to

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