tags:

views:

47

answers:

0

Given a set of points in 2D the resulting polygon can be convex, concave or 'not a polygon'. The definition that I am using for 'not a polygon' is that the line connecting two points crosses another 'polygon' line. I know about taking the dot product (Green's Theorem?) to show convexity and concavity of a polygon. I know that the sum of all interior angles must be (n - 2)*180, and I have a great algorithm from Mathworld for it. But the algorithm is expensive. Is there a way to determine that a set of points is not a polygon which is at least as cheap as the dot product?

MATHWORLD: cos A = (b**2 + c**2 - a**2)/2bc

where A, B, C are the interior angles, and a, b, c are the opposing sides.

To show it is a polygon, cos (SUM(A)) = cos ((n - 2)*180) = +-1