| |||
| [Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] |
|
On Nov 16, 2006, at 1:36 PM, CYB wrote: Hi everyone, The classic solution to this is to calculate the root mean squares of the co-ordinates and sort those. For example: given {5.0, 120}, {10.0, 10.0}, {70.0, 20.0} and {70.0, 80.0} you get (5^2 + 120^2)/2, (10^2 + 10^2)/2, (70^2 + 20^2)/2 and (70^2 + 80^2)/2 which translates to: 7212, 100, 2650, and 5650 From here it's easy to see which one is mathematically closest to top left, and which one is furthest. The biggest issue you'll have is objects that have the same RMS value. For example (working on points for now), is {100, 10} closer to the "top left" than {10,100}. Both are equidistant from the corner, but one is more "left" and the other is more "top". Once you have the RMS values you can look back at the originals to choose whether the lower x or y coordinate has priority. Working out the clockwise orientation from that is a little trickier. Off hand it probably requires polar coordinates and I can't get my mind around those until I have more coffee. Andrew :) |
_______________________________________________ Do not post admin requests to the list. They will be ignored. AppleScript-Users mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/applescript-users/email@hidden Archives: http://lists.apple.com/mailman//archives/applescript-users This email sent to email@hidden
| References: | |
| >Sort a list of lists (From: CYB <email@hidden>) |
| Home | Archives | FAQ | Terms/Conditions | Contact | RSS | Lists | About |
Visit the Apple Store online or at retail locations.
1-800-MY-APPLE
Contact Apple | Terms of Use | Privacy Policy
Copyright © 2007 Apple Inc. All rights reserved.