多边形顶点 - 顺时针或逆时针

vad*_*n p 2 geospatial computational-geometry

我遇到了这个链接http://www.mathopenref.com/coordpolygonarea2.html

它解释了如何计算多边形的面积,并帮助确定我们输入的多边形顶点是顺时针还是逆时针.

如果面积值为+ ve,则为顺时针,如果为-nv,则为逆时针.

我的要求是仅确定它是顺时针还是逆时针.此规则是否正常工作(尽管链接中提到了一些限制).我只有正多边形(不复杂,没有自交叉),但顶点更多.

我对面积值精度不感兴趣,只是为了知道环的旋转.

对此有任何其他想法.

del*_*unt 9

对于凸多边形:

Select two edges with a common vertex. 
Lets say, edge1 is between vertex A and B. Edge2 is between vertex B and C.
Define to vectors: vect1: A----->B
                   vect2: B----->C
Cross product vect1 and vect2. 
If the result is positive, the sequence A-->B-->C is Counter-clockwise. 
If the result is negative, the sequence A-->B-->C is clockwise. 
Run Code Online (Sandbox Code Playgroud)


Jos*_*rke 5

如果你只有凸多边形(并且所有正多边形都是凸面的),并且如果你的点都是一致的 - 无论是逆时针还是顺时针 - 那么你可以通过计算一个三角形的(带符号)面积来确定连续三个点.这基本上计算沿两个边缘的两个矢量的叉积.