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

This is because of the precision errors of floating-point arithmetic.
Try to round the results:

import flash.geom.Point;

var angles: Array = [0, 90, 180, 270, 360];

for (var i = 0; i < angles.length; i++) {
        var p: Point = Point.polar(10, (angles[i] * (Math.PI/180)));
        trace("x: " + Math.round(p.x) + ", y: " + Math.round(p.y));
}

  Attila

_______________________________________________
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