Trigonometry functions use degrees instead of radians - Node.js Geometry

Node.js examples for Geometry:Trigonometric functions

Description

Trigonometry functions use degrees instead of radians

Demo Code


///*from ww  w .  java2s. co  m*/
// These trigonometry functions use degrees instead of radians.
//
function sinD(n)  { return Math.sin (n * 0.0174532925199433); }
function cosD(n)  { return Math.cos (n * 0.0174532925199433); }
function tanD(n)  { return Math.tan (n * 0.0174532925199433); }
function asinD(n) { return Math.asin(n) * 57.2957795130823;   }
function acosD(n) { return Math.acos(n) * 57.2957795130823;   }
function atanD(n) { return Math.atan(n) * 57.2957795130823;   }


function Int(n) { return n < 0 ? Math.ceil(n) : Math.floor(n); }
function Sign(n) { if (n < 0) return -1; if (n > 0) return 1; return 0; }

Related Tutorials