[Math] Clockwise or anticlockwise edges in a polygon

geometry

Suppose a polygon with $n$ vertices is given $(V_1,V_2,… V_n)$.
If the $(x,y)$ coordinates of the each vertex of the polygon are given, then how can we find that the vertices $V_1,V_2,V_3$… $V_n$ are in clockwise or anticlockwise fashion? – that is, I need to find that if we are moving from $V_1,V_2,\dots V_n$, we are in clockwise or anticlockwise direction.

What I tried :
I found the center of the polygon and took the origin of the coordinate system at the center, and then calculated the angle between the $x$ axis and the vertex.

Problem :
Two vertices may be at same angle.

I need some solution which can be implemented in computer logic.

Best Answer

Everything you need is at this Wolfram Mathworld link. Just compute the area using the expression given there. If the result is positive, the points are anticlockwise; if the result is negative, the points are clockwise.

Related Question