弧度转换为度数的方法是什么?

问题描述 投票:0回答:12

我偶尔会遇到这种情况,但总是忘记怎么做。

经常出现的事情之一。

另外,将以弧度表示的角度转换为度数并再转换回来的公式是什么?

algorithm math trigonometry
12个回答
307
投票
radians = degrees * (pi/180)

degrees = radians * (180/pi)

至于实现,主要问题是您希望 pi 的值有多精确。有一些相关的讨论这里


11
投票

以弧度表示的完整圆是 2*pi。完整的圆(以度为单位)为 360。要从度数转换为弧度,则为 (d/360) * 2*pi,或 d*pi/180。


9
投票

x 弧度 - > x*180/pi
x 弧度度 -> x*pi/180

我猜你是否想为此创建一个函数[用 PHP]:

function convert($type, $num) {
    if ($type == "rads") {
          $result = $num*180/pi();
        }

    if ($type == "degs") {
          $result = $num*pi()/180;
        }

    return $result;
  }

是的,可能可以写得更好。


7
投票

在 javascript 中你可以这样做

radians = degrees * (Math.PI/180);

degrees = radians * (180/Math.PI);

0
投票

这对我来说已经足够好了:)

// deg2rad * degrees = radians
#define deg2rad (3.14159265/180.0)
// rad2deg * radians = degrees
#define rad2deg (180/3.14159265)

0
投票

.NET8:https://github.com/dotnet/runtime/issues/86402

double.RadiansToDegrees(1);
float.DegreesToRadians(1);

-1
投票

180 度 = PI * 弧度


-1
投票

360度是2*PI弧度

您可以在以下位置找到转换公式:http://en.wikipedia.org/wiki/Radian#Conversion_ Between_radians_and_ Degrees


-1
投票

360 度 = 2*pi 弧度

这意味着 deg2rad(x) = x*pi/180 且 rad2deg(x) = 180x/pi;


-1
投票

pi 弧度 = 180 度

所以 1 度 = pi/180 弧度

或 1 弧度 = 180/pi 度


-1
投票

这里是一些使用

rad(deg)
deg(rad)
以及两个更有用的函数扩展 Object 的代码:
getAngle(point1,point2)
getDistance(point1,point2)
,其中一个点需要具有
x
y
属性。

Object.prototype.rad = (deg) => Math.PI/180 * deg;
Object.prototype.deg = (rad) => 180/Math.PI * rad;
Object.prototype.getAngle = (point1, point2) => Math.atan2(point1.y - point2.y, point1.x - point2.x);
Object.prototype.getDistance = (point1, point2) => Math.sqrt(Math.pow(point1.x-point2.x, 2) + Math.pow(point1.y-point2.y, 2));

-2
投票
radians = (degrees/360) * 2 * pi
© www.soinside.com 2019 - 2024. All rights reserved.