Lots of cool stuff in the Rectangle class too, in case you didn't
know :)
Piers
On 17 Mar 2009, at 15:00, Eric E. Dolecki wrote:
Thanks man, you just changed my world.
On Tue, Mar 17, 2009 at 10:26 AM, Merrill, Jason <
[email protected]> wrote:
I have the angle (say 0 degrees).
The length would then be pixels from the
center (ie. radius)?
Yes, radius is pixel distance from starting point (in your case,
the center
point of the circle). Then you just need to convert angle to
radians and
you're good to go.
var cartesianPoint:Point = Point.polar(len, angleInRadians);
Here are some handy methods for you from one of my extended math
classes:
public static function polarToCartesian(distance:Number,
degrees:Number):Point
{
var radians:Number = (degrees * Math.PI) / 180;
return Point.polar(distance, radians);
}
public static function degreesToRadians(degrees:Number):Number
{
return (degrees * Math.PI)/180;
}
public static function radiansToDegrees(radians:Number):Number
{
return (radians*180)/Math.PI;
}
public static function cartesianAngle(fromPoint:Point,
toPoint:Point):Number
{
var radians:Number = Math.atan2(toPoint.y-fromPoint.y,
toPoint.x-fromPoint.x);
var backAzimuthDegrees:Number =
MathTranslation.radiansToDegrees(radians);
return MathTranslation.getBackAzimuth(backAzimuthDegrees);
}
public static function getBackAzimuth(angle:Number):Number
{
var backAzimuth:Number;
if(angle < 180)
{
var tempNeg:Number = angle-180;
backAzimuth = tempNeg + 360;
}
else
{
backAzimuth = angle-180;
}
return backAzimuth;
}
Also, see this article:
http://livedocs.adobe.com/flash/9.0/main/wwhelp/wwhimpl/common/html/wwhelp.htm?context=LiveDocs_Parts&file=00002060.html
Jason Merrill
Bank of America | Learning Performance Solutions Instructional
Technology & Media
Monthly meetings on the Adobe Flash platform for rich media
experiences -
join the Bank of America Flash Platform Community
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
--
http://ericd.net
Interactive design and development
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders
Piers
[email protected]
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders