日韩av黄I国产麻豆传媒I国产91av视频在线观看I日韩一区二区三区在线看I美女国产在线I麻豆视频国产在线观看I成人黄色短片

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) >

python中怎么输入角度_在Python中更正两点之间的角度

發(fā)布時(shí)間:2025/3/15 40 豆豆
生活随笔 收集整理的這篇文章主要介紹了 python中怎么输入角度_在Python中更正两点之间的角度 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

我有一個(gè)Python代碼應(yīng)用程序,它記錄鼠標(biāo)活動(dòng)(按規(guī)則間隔記錄的點(diǎn),時(shí)間等待),然后處理數(shù)據(jù)以輸出鼠標(biāo)移動(dòng)的角度(Y軸為0)和它移動(dòng)的速度。

目前我的輸出是東0度,南-90度,西180度,北90度,這不是我的預(yù)期輸出。我不確定三角法或其他計(jì)算中是否有問(wèn)題,所以希望對(duì)這方面的任何幫助。

i = 0

angles = []

speeds = []

#positions is an array of coordinates taken 0.1 seconds apart from each other

for point in positions:

if i is not 0:

pointY = 2500 - point[1] #invert position of X and assign variable

deltaX = point[0]-pointXP # difference is current pointX minus PointXPast

deltaY = pointY-pointYP

dist = math.sqrt(deltaX**2 + deltaY**2) #distance is the hypotenuse

if dist is 0: #if the mouse has not moved

continue

speed = dist/timeWait # speed is distance/time

angle = math.degrees(math.atan2(deltaY,deltaX)) #angle using Tan

angles.append(angle)

speeds.append(speed)

pointXP = point[0]

pointYP = pointY

else: #this is only for the first iteration

i = 1

pointXP = point[0]

pointYP = 2500 - point[1]

continue

再次感謝您的幫助,特別是關(guān)于我的角度被關(guān)閉。謝謝。

總結(jié)

以上是生活随笔為你收集整理的python中怎么输入角度_在Python中更正两点之间的角度的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。