Skip to content

semibran/radians

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 

Repository files navigation

radians

degree radian conversion

In JavaScript, methods like Math.sin, Math.atan2, and CanvasRenderingContext2D.arc use radians instead of degrees. It may be helpful to have functions to convert between the two to reduce instances of Math.PI / 180 in your code, as they may appear misleading.

The API for this module is based off of Elm's built-in angle conversion functions.

usage

NPM

> const { degrees, radians } = require('radians')
> var angle = 45
> radians(degrees(angle)) === angle
true

degrees(degrees)

Converts degrees to its corresponding value in radians.

> degrees(30)
0.5235987755982988

radians(radians)

Converts radians to its corresponding value in degrees.

> radians(0.5235987755982988)
29.999999999999996

> radians(0.5235987755982989)
30.000000000000004

see also

license

MIT © Brandon Semilla

Releases

No releases published

Packages

No packages published