기본 콘텐츠로 건너뛰기

라벨이 Clockwise인 게시물 표시

whether clockwise or counterclockwise

picbuddy님의 블로그(Mesh Generation) | 서캐 http://blog.naver.com/picbuddy/80021589591 Determining whether or not a polygon (2D) has its vertices ordered clockwise or counterclockwise Written by Paul Bourke March 1998 The following describes a method for determining whether or not a polygon has its vertices ordered clockwise or anticlockwise for both convex and concave polygons. A polygon will be assumed to be described by N vertices, ordered $$ (x_0,y_0),(x_1,y_1),(x_2,y_2),...(x_{n-1},y_{n-1}) $$ A simple test of vertex ordering for convex polygons is based on considerations of the cross product between adjacent edges. If the crossproduct is positive then it rises above the plane (z axis up out of the plane) and if negative then the cross product is into the plane. $$ \begin{aligned} cross product &= ((x_i - x_{i-1}),(y_i - y_{i-1})) \times ((x_{i+1} - x_i),(y_{i+1} - y_i))\\ &= (x_i - x_{i-1}) * (y_{i+1} - y_i) - (y_i - y_{i-1}) * (x_{i+1} - x_i) \en...