lilypond-devel
[Top][All Lists]

## Re: skyline vertical spacing

 From: Joe Neeman Subject: Re: skyline vertical spacing Date: Tue, 14 Nov 2006 11:30:52 +0200

On 11/14/06, Erik Sandberg <address@hidden> wrote:
Just a question: I have been thinking about skyline spacing in music for a
while (trying to figure out cases where skyline spacing can give bad
results), and I have one idea: In some cases, objects could come too close
together with skyline spacing. E.g., if a stem sticks up from one staff, and
a horizontally nearby stem sticks down from the staff above, the stems could
end up too close to each other, like:

======
==o===
|
|||
|||
| |
=o=o==
=====

I have an idea on how to work around this problem: We could define a maximum
slope for 'sloped-roof' skylines; i.e., for vertical spacing, we allow
horizontal lines but not vertical lines, instead the slope of a skyline can
maximally be (say) 60 degrees. So the skyline of the upper staff becomes
something like (sorry for the lousy ascii art):

===============
__===o===____
\  |  /
\ | /
\|/

With the right choice of maximum slope, this would hopefully increase the
distance sufficiently to prevent too tight spacing.

I know nothing about the theories of skylines, and I haven't looked at your
code yet, so maybe there is a better solution to the problem already;

If there are any references about  skylines around, I'd be interested in seeing them; I just made things up as I went. Your suggestion (which seems very good to me) brings up a very interesting idea: is there ever any need to have vertical "walls" in the skyline? I can't think of any situation where we would want the spacing (vertical or horizontal) to look like your first example. If we could get rid of vertical walls in the skyline, it would simplify the representation and the algorithm considerably.

It would also deal solve some numerical accuracy issues. If I have 2 double-sharps a third apart, the bottom of one is _exactly_ at the same y-coordinate as the top of the other. Since we currently do skylines as boxes with vertical sides, it would only take some floating point error to cause the skylines not to collide and the double-sharps to end up vertically stacked. With sloped skylines, a tiny error would only cause them to move towards each other by a proportional amount.