Google Search

Friday, October 7, 2011

Converting Angle Measurements in graphics


 Converting Angle Measurements


function degToRad(deg)
{
return (Math.PI*deg)/180;
}
function radToDeg(rad)
{
return (rad*180)/Math.PI;
}
trace("Converting 90 degrees to radians:"+degToRad(90));
trace("Converting 3.14 radians to degrees:"+radToDeg(Math.PI));
trace("Converting 36 degrees to radians using cos function:"+Math.cos(degToRad(36)));




---------------------------------------------------------------------------------
output
--------------------------------------------------------------------------------
Converting 90 degrees to radians:1.5707963267949
Converting 3.14 radians to degrees:180
Converting 36 degrees to radians using cos function:0.809016994374947

0 comments:

Post a Comment