这个图,对应的笛卡尔平面坐标系:原点在圆心,x正方向指向东,y正方向指向北
根据上图,可以知道12.5度的角度位置,箭头的方向是指向圆心的,这样就能确定了箭头在笛卡尔坐标系的指向
比如:入流风向为0,箭头方向指向圆心,就是说箭头是一个向下的;入流风向为90,箭头方向指向圆心,也就是说箭头是向左的
代码
def getAngel_xy(correctAngel):
x=0
y=0
if correctAngel> 0 and correctAngel <90:
x = -round(math.sin(math.radians(correctAngel)), 10)
y = -round(math.cos(math.radians(correctAngel)), 10)
if correctAngel> 90 and correctAngel <180:
correctAngel = correctAngel-90
x = -round(math.cos(math.radians(correctAngel)), 10)
y = round(math.sin(math.radians(correctAngel)), 10)
if correctAngel > 180 and correctAngel < 270:
correctAngel = correctAngel-180
x = round(math.sin(math.radians(correctAngel)), 10)
y = round(math.cos(math.radians(correctAngel)), 10)
if correctAngel> 270 and correctAngel <360:
correctAngel = correctAngel-270
x = round(math.cos(math.radians(correctAngel)), 10)
y = -round(math.sin(math.radians(correctAngel)), 10)
if correctAngel==0 or correctAngel== 360:
x =0
y = -1
if correctAngel==90:
x = -1
y = 0
if correctAngel == 180:
x = 0
y = 1
if correctAngel == 270:
x = 1
y = 0
return x,y