請問怎麼把檔案內的點以逆時針方向存取?
檔案內給多個形成polygon的點,有些為順時針有些為逆時針,例如
p 4
79152 36600 85827 36600 85827 45506 79152 45506
p 6
3 5 4 5 4 7 2 7 2 6 3 6
p 4 帶表為4邊形,其下面的數字為4邊形的4個頂點x1 y1 x2 y2 x3 y3 x4 y4
檔案沒有固定幾邊形就是順或逆時針,
請問要如何判斷polygon給的點為順或逆時針並且全部改為逆時針存取??
謝謝。
[解决办法]
a simple google found this
http://stackoverflow.com/questions/1165647/how-to-determine-if-a-list-of-polygon-points-are-in-clockwise-order
for your application, if the sum turns out to be positive for a polygon, then reverse the ordering of the vertices of that polygon will bring it to a counter clockwise order. some of their following discussions are also informative, with links to insightful sources for further study in case you are interested.
請問怎麼把檔案內的點以逆時針方向存取?解决思路
請問怎麼把檔案內的點以逆時針方向存取?檔案內給多個形成polygon的點,有些為順時針有些為逆時針,例如p 4 7
