Posted By

bshantz on 10/02/10


Tagged

as3 trigonometry radians


Versions (?)

Who likes this?

3 people have marked this snippet as a favorite

bobbym245
thastyle
tspitzr


Radians / Degrees Utility AS3


 / Published in: ActionScript 3
 

example: posX += Math.cos(Radians.fromDegrees(rotation)) * speed;

  1. package utils {
  2.  
  3. public class Radians {
  4.  
  5. public function Radians() {
  6.  
  7. }
  8.  
  9. /* Radians to degrees */
  10. public static function toDegrees(radians:Number):Number
  11. {
  12. return radians * 180 / Math.PI;
  13. }
  14.  
  15. /* Degrees to radians */
  16. public static function fromDegrees(degrees:Number):Number
  17. {
  18. return degrees * Math.PI / 180;
  19. }
  20. }
  21. }

Report this snippet  

You need to login to post a comment.