You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
362 B
20 lines
362 B
2 years ago
|
|
||
|
/**
|
||
|
* Convert given value's base into the parameter unitName
|
||
|
*
|
||
|
* @param {Double} value
|
||
|
* @param {String} unitName
|
||
|
* @return {Double}
|
||
|
* @api private
|
||
|
*/
|
||
|
|
||
|
module.exports = function convertAngle(value, unitName) {
|
||
|
var factors = {
|
||
|
"rad" : 1,
|
||
|
"deg" : 180 / Math.PI,
|
||
|
"turn": 0.5 / Math.PI,
|
||
|
"grad": 200 / Math.PI
|
||
|
}
|
||
|
return value * factors[unitName];
|
||
|
}
|