Hello! I can't use my server on 24 hours when 1 year later, so I decide to find free web hosting service.
Now, my sites & blog are moving to the http://sokoyo.co.cc
You can find new archives in the new space.
Of course, you can read the old archives in the new place, too.
But you may feel strange about the archives.
I will modify the archives when I have time in the future.
Thanks for your attention. :)
Hello! 因為我一年後就沒辦法架 server 了,所以我打算用免費的網路空間。
我的 Blog 和網站正移往 http://sokoyo.co.cc
你可以在那找到我新的東西
當然你也可以在那找到舊東西
不過可能會看起來怪怪的
我以後有時間會修改它
感謝您注意我的網站 :)
2008/09/25
2008/09/12
2008/09/01
判斷三點間順時針或逆時針的關係
若有三點如上圖所示
要判斷 P2 在 P1 的哪個方向
可以先利用 V1.V2 = |V1| |V2| cosθ 和 arccos(cosθ) 求得角度
要判斷順時針與逆時針則先求得 vector_P0P1 與 vector_P0P2
Let
vector_P0P1 = (vx1, vy1) = (P1x - P0x, P1y - P0y)
vector_P0P2 = (vx2, vy2) = (P2x - P0x, P2y - P0y)
則
vector_P0P1 X vector_P0P2 > 0 為圖左方,逆時針(counter-clockwise)
vector_P0P1 X vector_P0P2 < 0 為圖右方,順時針(clockwise)
vector_P0P1 X vector_P0P2 = (vx1, vy1) X (vx2, vy2) =
| vx1 vx2 |
| vy1 vy2 | = vx1*vy2 - vx2*vy1 = |P1P0| |P2P0| sinθ
所以
vx1*vy2 - vx2*vy1 > 0 為圖左方,逆時針(counter-clockwise)
vx1*vy2 - vx2*vy1 < 0 為圖右方,順時針(clockwise)
參考資料:http://www.csie.nctu.edu.tw/~sctsai/adprog/notes/CompGeo.ppt
Subscribe to:
Posts (Atom)