function sinD(degree) { switch(degree % 360) { case 0: return 0.0; case 90: return 1.0; case 270: return -1.0; default: return Math.sin(Math.PI * degree / 180.0); } } function cosD(degree) { switch(degree % 360) { case 0: return 1.0; case 180: return -1.0; default: return Math.cos(Math.PI * degree / 180.0); } } function tanD(degree) { switch(degree % 360) { case 0: return 0.0; default: return Math.tan(Math.PI * degree / 180.0); } }