What is the method for converting radians to degrees?

后端 未结 12 2657
慢半拍i
慢半拍i 2020-12-02 05:24

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 expre

相关标签:
12条回答
  • 2020-12-02 05:42

    360 degrees = 2*pi radians

    That means deg2rad(x) = x*pi/180 and rad2deg(x) = 180x/pi;

    0 讨论(0)
  • 2020-12-02 05:44

    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.

    0 讨论(0)
  • 2020-12-02 05:48

    Here is some code which extends Object with rad(deg), deg(rad) and also two more useful functions: getAngle(point1,point2) and getDistance(point1,point2) where a point needs to have a x and y property.

    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));
    
    0 讨论(0)
  • 2020-12-02 05:48
    radians = (degrees/360) * 2 * pi
    
    0 讨论(0)
  • 2020-12-02 05:53

    360 degrees is 2*PI radians

    You can find the conversion formulas at: http://en.wikipedia.org/wiki/Radian#Conversion_between_radians_and_degrees.

    0 讨论(0)
  • 2020-12-02 05:54

    pi Radians = 180 degrees

    So 1 degree = pi/180 radians

    or 1 radian = 180/pi degrees

    0 讨论(0)
提交回复
热议问题