日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 编程语言 > python >内容正文

python

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

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

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

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

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中更正两点之间的角度的全部內(nèi)容,希望文章能夠幫你解決所遇到的問題。

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