I don't know if this is actually the best way, but this is how I would do it:
Find the average x and average y to get the center. Find the angle from this center point to each other point. Sort by those angles. It's a tough problem to define--for example, imagine ten points along the circumference of a circle. Now put a point inside. How should it be connected? In that case, I think my solution will minimize concavities and distance between vertices, but that's not true for all cases. (Twelve points along the circumference of a circle and twelve points along the circumference of a much bigger circle, for example.) You'll have to think about what you want. -- View this message in context: http://www.nabble.com/logic-help-tf2862831.html#a8001503 Sent from the JQuery mailing list archive at Nabble.com. _______________________________________________ jQuery mailing list discuss@jquery.com http://jquery.com/discuss/