From: Benjamin Root [mailto:ben.r...@ou.edu] 
Sent: Friday, August 19, 2011 13:43
 
I have an arbitrary list of coordinates that I know represent the boundary of
a polygon.  Is there some sort of function from the contouring or path codes
that would allow me to pass in that list and get back the resorted list with
the path codes with it?

Hi, Ben. Is it the order of the points around the polygon that is unknown, and
is it unambiguous because the polygon is known to be convex? If so, I believe
you could use part of the Graham scan [1] convex hull algorithm. The function
you need would find the point P with the lowest Y coordinate, then sort the
remaining points by the cosine of the angle they and P make with the X axis.
After that, the list comprising P and the sorted points would need the path
codes.

If the polygon is concave but the order is somehow clear (e.g., a radial
progression about the average coordinate), you might be able to adapt the
method. I hope I understood your problem correctly and that this helps.

[1] http://en.wikipedia.org/wiki/Graham_scan

------------------------------------------------------------------------------
EMC VNX: the world's simplest storage, starting under $10K
The only unified storage solution that offers unified management 
Up to 160% more powerful than alternatives and 25% more efficient. 
Guaranteed. http://p.sf.net/sfu/emc-vnx-dev2dev
_______________________________________________
Matplotlib-users mailing list
Matplotlib-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-users

Reply via email to