[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: Make sure slurs actually avoid stafflines. (issue 15400049)
From: |
Janek Warchoł |
Subject: |
Re: Make sure slurs actually avoid stafflines. (issue 15400049) |
Date: |
Fri, 15 Nov 2013 17:40:01 +0100 |
Hi Keith,
I'm sorry for not replying earlier - i had to focus on other things,
and i didn't have time to spare on the slur stuff. Thanks for all
your suggestions; i'll get back to this when i finish one thing i have
to do for Urs (hopefully after the weekend).
best,
JAenk
2013/11/12 <address@hidden>:
> 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/