Converting Between Radians and Degrees


/ Published in: ActionScript 3
Save to your folder(s)

<p>When dealing with equations involving angles you will often be dealing in radians and not degrees. Display objects in Flash use degrees when dealing with their rotation property so we need a way to convert between the two. These helper function are useful for accomplishing just that; one for converting radians to degrees and the other degrees to radians.</p>


Copy this code and paste it in your HTML
  1. function degrees(radians:Number):Number
  2. {
  3. return radians * 180/Math.PI;
  4. }
  5.  
  6. function radians(degrees:Number):Number
  7. {
  8. return degrees * Math.PI / 180;
  9. }

URL: http://enva.to/e4ig6z

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.