Return to Snippet

Revision: 52581
at October 27, 2011 01:12 by adrianparr


Updated Code
private function getPolarPoint($startPt:Point, $degrees:Number, $distance:Number):Point 
{
	var destinationPt:Point = new Point();
	destinationPt.x = $startPt.x + Math.round($distance * Math.cos( $degrees * Math.PI / 180 ));
	destinationPt.y = $startPt.y + Math.round($distance * Math.sin( $degrees * Math.PI / 180 ));
	return destinationPt;
}

Revision: 52580
at October 27, 2011 01:10 by adrianparr


Initial Code
private function getPolarPoint($startPt:Point, $degrees:Number, $distance:Number):Point 
{
	var destinationPt:Point = new Point();
	var radians:Number = $degrees * Math.PI / 180;
	var x:Number = $startPt.x;
	var y:Number = $startPt.y;
	destinationPt.x = x + Math.round($distance * Math.cos( radians ));
	destinationPt.y = y + Math.round($distance * Math.sin( radians ));
	return destinationPt;
}

Initial URL


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

Initial Title
AS3 Get Point Using Polar Co-ordinates

Initial Tags


Initial Language
ActionScript 3