Convert degrees to radians and convert radians to degrees (signed) - Node.js Geometry

Node.js examples for Geometry:Radian

Description

Convert degrees to radians and convert radians to degrees (signed)

Demo Code

Number.prototype.toRad = function() {  // convert degrees to radians
  return this * Math.PI / 180;
}

Number.prototype.toDeg = function() {  // convert radians to degrees (signed)
  return this * 180 / Math.PI;
}

Related Tutorials