将弧度转换为度数的方法是什么?
我偶尔会遇到这种情况,但总是忘记该怎么做。
其中之一是经常出现的事情。
另外,将以弧度表示的角度转换为度数并再转换回来的公式是什么?
I run into this occasionally and always forget how to do it.
One of those things that pop up ever so often.
Also, what's the formula to convert angles expressed in radians to degrees and back again?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(12)
pi 弧度 = 180 度
因此 1 度 = pi/180 弧度
或 1 弧度 = 180/pi 度
pi Radians = 180 degrees
So 1 degree = pi/180 radians
or 1 radian = 180/pi degrees
360 度 = 2*pi 弧度
这意味着 deg2rad(x) = x*pi/180 且 rad2deg(x) = 180x/pi;
360 degrees = 2*pi radians
That means deg2rad(x) = x*pi/180 and rad2deg(x) = 180x/pi;
x 弧度(度)-> x*180/pi
x 度(以拉德为单位)-> x*pi/180
我猜你是否想为此创建一个函数[用 PHP]:
是的,这可能可以写得更好。
x rads in degrees - > x*180/pi
x degrees in rads -> x*pi/180
I guess if you wanted to make a function for this [in PHP]:
Yes, that could probably be written better.
在javascript中你可以这样做
In javascript you can do it this way
.NET8:https://github.com/dotnet/runtime/issues/86402
.NET8: https://github.com/dotnet/runtime/issues/86402
这对我来说已经足够好了:)
This works well enough for me :)
180 度 = PI * 弧度
180 degrees = PI * radians
360 度为 2*PI 弧度
您可以在以下位置找到转换公式: http://en.wikipedia .org/wiki/Radian#Conversion_ Between_radians_and_ Degrees 。
360 degrees is 2*PI radians
You can find the conversion formulas at: http://en.wikipedia.org/wiki/Radian#Conversion_between_radians_and_degrees.
至于实现,主要问题是您希望 pi 的值有多精确。 这里有一些相关的讨论
As for implementation, the main question is how precise you want to be about the value of pi. There is some related discussion here
以弧度表示的完整圆是 2*pi。 一个完整的圆(以度为单位)为 360。要从度数转换为弧度,则为 (d/360) * 2*pi,或 d*pi/180。
a complete circle in radians is 2*pi. A complete circle in degrees is 360. To go from degrees to radians, it's (d/360) * 2*pi, or d*pi/180.
下面是一些使用
rad(deg)
、deg(rad)
以及两个更有用的函数扩展 Object 的代码:getAngle(point1,point2)
和getDistance(point1,point2)
其中点需要具有x
和y
属性。Here is some code which extends Object with
rad(deg)
,deg(rad)
and also two more useful functions:getAngle(point1,point2)
andgetDistance(point1,point2)
where a point needs to have ax
andy
property.