Two simple fixes:
1) Always have some stretchability between notes
2) If there _is_ a completely unstretchable line, shorter than the line-width,
score it as a bad fit, not as a perfect fit (report large forces for stiff lines).
Either one would fix the problem; both seem to be good to have in the code.
inv_hooke += springs_[i].inverse_stretch_strength ();
if (inv_hooke == 0.0) /* avoid division by zero. If springs are infinitely stiff */
- return 0.0; /* anyway, then it makes no difference what the force is */
+ inv_hooke = 1e-6; /* then report a very large stretching force */
assert (cur_len <= line_len_);
return (line_len_ - cur_len) / inv_hooke + force_;
ret = Spring (fraction * len, fraction * min);
// Stretch proportional to the space between canonical bare noteheads
- ret.set_inverse_stretch_strength (fraction * max (0.0, (len - min)));
+ ret.set_inverse_stretch_strength (fraction * max (0.1, (len - min)));
}
else if (delta_t.grace_part_)
{