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
This is great, Joe. If you can get it to a point where it is feature compatible such that it eliminates the calls to both intersection and distance, lemme know. I'll have time to work on it together in the AM for the next few days. I am starting to understand how this solution works but I don't think I could write it from scratch w/o doing more thinking so if you have something almost functional I'd rather go from that.
Cheers, MS |