[Chicago-talk] Interesting sort question

Brian Drawert brian at deadtide.com
Thu Feb 26 17:16:27 CST 2004

Hi, I've attached a perl file with the function 'move_points()', and 3 
helper functions and some sample code (all  in perl of course).  I've 
done a moderate amount of testing, but anybody on this list who feels 
inclined can test it out and let me know if I messed anything up.  The 
only bug I am aware of is that it has no infinite recursion catch, so 
if you have too many data-points for the min-to-max-by-dist it will 
probably run forever.  Also it expects the array to be an ordered list.

Let me know how this works out.

   Brian Drawert

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ct_ptmv.pl
Type: application/text
Size: 7991 bytes
Desc: not available
Url : http://mail.pm.org/pipermail/chicago-talk/attachments/20040226/2668f9b6/ct_ptmv.bin
-------------- next part --------------

On Feb 26, 2004, at 12:56 PM, jason gessner wrote:

> Hi All.
> I am having a brain freeze and am turning to you for help.
> I have a list that looks like this:
> [
> 	[39, 29.7600],
> 	[33, 51.4300],
> 	[37, 77.0400],
> 	[41, 106.5900],
> 	[45, 124.3200],
> 	[35, 142.0500],
> 	[43, 167.6600]
> ]
> For the sublists, the first point is simply an ID, the 2nd is the 
> center
> point Y value for the element.
> Each of these elements represents an item on a vertical bar.
> Users can drag elements along the bar, but the labels (the 2nd element 
> in
> each array item is the y position for the given element number (1st 
> element)
> ).
> 	Items cannot exceed MAX_Y or go below MIN_Y (top and bottom
> locations of the bar).
> 	items need to be separated by MIN_DIST of distance.
> 	if an item overlaps with another then the item, and the item it
> overlaps with need to move a bit, just enough to give them MIN_DIST 
> apart.
> Keep in mind that an item can't go above MAX_Y or below MIN_Y.
> I can get it to go for the first pass, but it falls down when there 
> are a
> lot of them near each other.
> Beer at the next meeting for whomever helps unstick my head on this 
> one.
> -jason scott gessner
>     jason at multiply.org
> _______________________________________________
> Chicago-talk mailing list
> Chicago-talk at mail.pm.org
> http://mail.pm.org/mailman/listinfo/chicago-talk

More information about the Chicago-talk mailing list