rbartoli
3/20/2015 - 8:18 PM

Versions of Math.cos, Math.sin, and Math.tan that accept values in degrees instead of radians.

Versions of Math.cos, Math.sin, and Math.tan that accept values in degrees instead of radians.

(function (R) {
  Math.cosd = function(d) { return Math.cos(d * R); };
  Math.sind = function(d) { return Math.sin(d * R); };
  Math.tand = function(d) { return Math.tan(d * R); };
})(Math.PI / 180);