python弧度值转角度值_python 弧度与角度互转实例
我就廢話(huà)不多說(shuō)了,還是直接看代碼吧!
import math
def deal(yaw):
if(yaw<0):
print(-(abs(yaw)/math.pi)*180)
print(math.degrees(yaw))
else:
print((abs(yaw)/math.pi)*180)
print(math.degrees(yaw))
yaw=math.pi/6
deal(yaw)
yaw=-math.pi/3
deal(yaw)
輸出
30.0
29.999999999999996
-60.0
-59.99999999999999
補(bǔ)充知識(shí):MATLAB中角度轉(zhuǎn)換成弧度函數(shù)——degtorad
degtorad
Convert angles from degrees to radians
將角度從度數(shù)轉(zhuǎn)換為弧度
Syntax:angleInRadians = degtorad(angleInDegrees)
語(yǔ)法:弧度 = degtorad(角度)
Description
angleInRadians = degtorad(angleInDegrees) converts angle units from degrees to radians. This is both an angle conversion function and a distance conversion function, since arc length can be a measure of distance in either radians or degrees, provided that the radius is known.
描述:angleInRadians = degtorad(angleInDegrees)將角度單位從度數(shù)轉(zhuǎn)換為弧度。這是角度轉(zhuǎn)換函數(shù)和距離轉(zhuǎn)換函數(shù),因?yàn)榛¢L(zhǎng)可以是弧度或度數(shù)的距離的度量,只要半徑是已知的。
Examples
Show that there are 2π radians in a full circle:
2*pi - degtorad(360)
ans =
0
例子
顯示整個(gè)圓圈內(nèi)有2π弧度:
以上這篇python 弧度與角度互轉(zhuǎn)實(shí)例就是小編分享給大家的全部?jī)?nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持。
總結(jié)
以上是生活随笔為你收集整理的python弧度值转角度值_python 弧度与角度互转实例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。
- 上一篇: html canvas粒子线条组合动画背
- 下一篇: Unity DOTS学习导航