Hello all, 

Im using the Point class to convert polar co-ordinates to Cartesian
co-ordinates (i.e. an angle & length to an x & y co-ordinate). The built in
function Point.polar(len:Number, angle:Number) should do exactly this but I
am getting some weird values returned.

This code takes the angles 0, 90, 180, 270 & 360 with a length of 10 for
each and converts to an x & y.

[[code snippet]]
import flash.geom.Point;

trace(Point.polar(10, (0 * (Math.PI/180))));
trace(Point.polar(10, (90 * (Math.PI/180))));
trace(Point.polar(10, (180 * (Math.PI/180))));
trace(Point.polar(10, (270 * (Math.PI/180))));
trace(Point.polar(10, (360 * (Math.PI/180))));

This is the output:

(x=10, y=0)
(x=6.12303176911189e-16, y=10)
(x=-10, y=1.22460635382238e-15)
(x=-1.83690953073357e-15, y=-10)
(x=10, y=-2.44921270764475e-15)

As you can see the first value is correct, the rest have weird values. Can
anyone explain this to me?

Jim

_______________________________________________
Flashcoders@chattyfig.figleaf.com
To change your subscription options or search the archive:
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

Brought to you by Fig Leaf Software
Premier Authorized Adobe Consulting and Training
http://www.figleaf.com
http://training.figleaf.com

Reply via email to