@svizzle/geometry/angle

Methods

(static) degToRad(degrees) → {number}

Source:
Since:
  • 0.6.0

Convert degrees to radians

Example
> degToRad(0)
0

> degToRad(45)
0.7853981633974483

> degToRad(90)
1.5707963267948966

> degToRad(180)
3.141592653589793

> degToRad(-90)
-1.5707963267948966
Parameters:
Name Type Description
degrees number

An angle in degrees

Returns:

radians - The same angle in radians

Type
number

(static) radToDeg(radians) → {number}

Source:
Since:
  • 0.6.0

Convert radians to degrees

Example
> radToDeg(0)
0

> radToDeg(Math.PI / 4)
45

> radToDeg(Math.PI / 2)
90

> radToDeg(Math.PI)
180

> radToDeg(Math.PI / 2)
-90
Parameters:
Name Type Description
radians number

An angle in radians

Returns:

degrees - The same angle in degrees

Type
number