Easy to view and reprint
1. How to determine whether a polygon is clockwise or counterclockwise
For a convex polygon, you only need to calculate a certain point.
Cross Product = (Xi-XI-1), (Yi-Yi-1) x (XI + 1-xi), (yi + 1-yi ))
= (Xi-XI-1) * (yi + 1-yi)-(Yi-Yi-1) * (XI + 1-xi)
If the value of the preceding formula is positive, it is counter-clockwise. If it is negative, it is clockwise.
For a general simple polygon, the above value needs to be calculated for each vertex of the polyon. If there are many positive values, the value is counter-clockwise. If there are many negative values, the value is clockwise.
2. Polygon Area
If the points of a polygon are in a counterclockwise order, the area value is positive, otherwise it is negative.
3. vertex concave and convex
The determination method of vertex concave and convex is introduced. For the area of a triangle consisting of I, I-1, I, I + 1 to be tested, the clockwise characteristics of the triangle are derived, convex vertex. Otherwise, it is a concave vertex)
This article from csdn blog: http://blog.csdn.net/w47189122/archive/2008/03/25/2217383.aspx