On Sat, Aug 18, 2012 at 5:34 AM, Keith OHara
<address@hidden> wrote:
floors[j] = padding - forest[j][UP]~distance~pair[DOWN]
ceilings[j] = forest[j][DOWN]~distance~pair[UP]
You know the solution will be to move an amount equal to one of the floors[j],
and you want to find the smallest that fits, so make
trials = sort (floors)
and find the smallest among trials that satisfies
trials[n] > 0
&& for all j (trials[n] > floors[j]
|| trials[n] < ceilings[j] )
I am not adverse to using distance if possible - my trouble case is the
following.
AAAAAAAAA
BBBBBBBBBBBBB
Image that object A above is placed first and LilyPond is now
considering whether it should leave B where it is or place it above A.
The distance function would dictate that it needs to be shifted above A
because its DOWN skyline is below A's UP.
We need not let the distance function between A[UP] and B[DOWN] dictate, because having positive distance between A[DOWN] and B[UP] is another solution.
If you check out the dev/jneem-skylines (which is a simplified but not (yet) feature-compatible version of Mike's branch), you'll see that I'm using this method under the name 'bool Skyline_pair::intersects.'
Cheers,
Joe