Re: [問題] 請益如何記錄不規則的座標值呢

看板C_and_CPP作者 (老師說要愛數學)時間10年前 (2015/05/21 07:46), 編輯推噓1(100)
留言1則, 1人參與, 最新討論串2/2 (看更多)
不知道五月都快過了才回應算不算挖考古文 請問你有試過轉極座標嗎? (theta,r) to (x,y) x=r cos(theta) y=r sin(theta) (x,y) to (theta,r) r=sqrt(x*x+y*y) theta=arctan(y/x) 然後定義 (theta1,r1) > (theta2,r2) if (theta2 > theta1) or (theta2 == theta1 and r1>r2) 然後隨便一個排序法就可以排出順時針的排序了 ----- Sent from JPTT on my HTC One dual 802d. -- ※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 222.251.34.243 ※ 文章網址: https://www.ptt.cc/bbs/C_and_CPP/M.1432165617.A.3EA.html

05/21 10:24, , 1F
話說這是數學 不是CS吧
05/21 10:24, 1F
文章代碼(AID): #1LNHpnFg (C_and_CPP)
文章代碼(AID): #1LNHpnFg (C_and_CPP)