Re: [问题] 请益如何记录不规则的座标值呢

楼主: PhysiAndMath (老师说要爱数学)   2015-05-21 07:46:55
不知道五月都快过了才回应算不算挖考古文
请问你有试过转极座标吗?
(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)
然后随便一个排序法就可以排出顺时针的排序了
作者: softseaweed (Gladys von Wackenheim)   2015-05-21 10:24:00
话说这是数学 不是CS吧

Links booklink

Contact Us: admin [ a t ] ucptt.com