Posted By

adrianparr on 10/27/11


Tagged

point x distance position as3 y Degrees radius Vector radians co-ordinates polar


Versions (?)

AS3 Get Point Using Polar Co-ordinates


 / Published in: ActionScript 3
 

This function returns a point object based upon the position, angle and distance of a starting point (polar co-ordinates).

  1. private function getPolarPoint($startPt:Point, $degrees:Number, $distance:Number):Point
  2. {
  3. var destinationPt:Point = new Point();
  4. destinationPt.x = $startPt.x + Math.round($distance * Math.cos( $degrees * Math.PI / 180 ));
  5. destinationPt.y = $startPt.y + Math.round($distance * Math.sin( $degrees * Math.PI / 180 ));
  6. return destinationPt;
  7. }

Report this snippet  

You need to login to post a comment.