我碰到了这个链接http://www.mathopenref.com/coordpolygonarea2.html
它说明了如何计算多边形的面积,并有助于识别我们输入的多边形顶点是顺时针还是逆时针。
如果area值为+ ve,则为顺时针;如果为-nv,则为逆时针。
我的要求是仅确定是顺时针还是逆时针。此规则是否正常运行(尽管存在链接中提到的限制)。我只有规则的多边形(不复杂,没有自相交),但顶点更多。
我对面积值的准确性不感兴趣,只是想知道环的旋转。
还有其他想法。
最佳答案
对于凸多边形:
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.
关于geospatial - 多边形顶点-顺时针或逆时针,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/9473570/