meta data for this page
This is an old revision of the document!
Conversions
Conversions between Degrees and Radians
Convert the given angle (degrees) to radians.
let radians = degToRad(90) // PI / 2 radians
Convert the given angle (radians) to degrees.
let degrees = radToDeg(Math.PI / 2) // 90 degrees
Conversions of Radius to Segments
Calculate the number of segments from the given radius based on minimum length or angle.
There are various round shapes that support the 'segments' option. Often times, a design requires a specific precision for each segment. This function assists by calculating the appropriate number of segments based on radius, as well as minimum length or minimum angle.
let segments = radiusToSegments(3.5, 0.1, 0) /* use minimum length */ let segments = radiusToSegments(3.5, 0, Math.PI * 2 / 300) /* use minimum angle */