Consider the following code which plots a triangle.
p = {{0, 0}, {.2, 0}, {0, .2}};
{Cyan, Polygon[Dynamic[p]]} // Graphics
Then adding (for example) {.1, -.1}
yields a non-simple polygon with intersecting lines.
AppendTo[p, {.1, -.1}]
Question: Given a list of 2D points that are plotted as a polygon by Graphics
. Is there a way to re-order the points such that Graphics
plots a simple polygon after a point which has been added that resulted in plotting a non-simple polygon?
p = {{-1, 1}, {1, 1}, {-1, -1}, {1, -1}, {0, 0}}
; what polygon should be plotted? – acl Aug 14 '12 at 8:55