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: Fri, 25 Oct 2013 06:18:50 +0000

The behavior of the first patch was good, only the code was difficult to
understand.  If you are tired, you could take a short break, and then
simplify the patch and it will be great.



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

https://codereview.appspot.com/15400049/diff/120001/lily/slur-configuration.cc#newcode91
lily/slur-configuration.cc:91: Real fac = (t - t*t + 0.5) * 4/3;
The effectiveness of the middle control points to move the horizontal
part of the slur depends in the same way on 't'.  You could let that
varying effectiveness have its natural result, and then move the
endpoints only 2/3 as much as you would to get the full gap.

https://codereview.appspot.com/15400049/diff/120001/lily/slur-configuration.cc#newcode93
lily/slur-configuration.cc:93: Interval const min_gap = Interval (fac *
state.parameters_.min_gap_below_staffline_,
The use of normalized directions and indexing UP for inside and DOWN for
outside was very hard for me to follow.  You could leave everything
right-side-up and just lookup the single Real-valued min_gap that you
need.

https://codereview.appspot.com/15400049/diff/120001/lily/slur-configuration.cc#newcode101
lily/slur-configuration.cc:101: // TODO: to handle weird staves well, we
should round to staffline positions.
The old code handled 4-line staves, so try to keep that.

Making a function nearest_staff_line() would be nice, but looking at the
code for on_staff_line() it seems it would not be simple.

You can check the two nearest staff positions:

Real pos = my_round(2*y); // cannot use norm_y
if (!on_staff_line(pos)) {
  pos += (pos < 2*y)? +1.0: -1.0;
  if (!on_staff_line(pos))
    return bez;
}

https://codereview.appspot.com/15400049/diff/120001/lily/slur-configuration.cc#newcode133
lily/slur-configuration.cc:133: Real mid_pts_cor = (1 - factor) *
correction / (3 * (t - (t * t)));
This is (|t-0.5| - 0.5) / 3t(1-t) * correction
so as t goes 0 to 0.5 to 1 it varies from 1/3 to 2/3 to 1/3

In the first patch, the variation was in the other direction:
big-small-big.

Maybe you could use  mid_pts_cor = 4.0/3.0 * correction
Then you have moved the horizontal point 4t(1-t) of the desired
correction, which is the complete correction if t is in the middle, less
toward the ends.

Then the remaining correction can be done by moving the endpoints, but
since you can allow the slur to be closer to a staff-line if the nearest
point is near an endpoint, just do half the remaining correction.

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

https://codereview.appspot.com/15400049/diff/120001/lily/slur.cc#newcode519
lily/slur.cc:519: "@item min-gap-above-staffline\n"
I meant to suggest that the property names be
 min-gap-to-staffline-inside
 min-gap-to-staffline-outside

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



reply via email to

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