Okay, so I'm taking my first little steps into 3d in actionscript (simulated
with x/yscale for now) and needed a version of Point.polar() (thanks Jason)
to play around with in 3 dimensions. I came up with the code below, but my
math skills are weak enough that I'm not sure it's functioning correctly.
Anyone care to school me on this or confirm the math is correct?
public static function polarToCartesian3D(distance:Number, degrees1:Number,
degrees2:Number ):Point3D
{
var a1:Number = (degrees1 * Math.PI) / 180 ;
var a2:Number = (degrees2 * Math.PI) / 180 ;
var x:Number = distance * Math.sin(a1) * Math.cos(a2) ;
var y:Number = distance * Math.sin(a1) * Math.sin(a2) ;
var z:Number = distance * Math.cos(a1) ;
return new Point3D(x, y, z) ;
}
Thanks in advance for the assist.
Jer
_______________________________________________
Flashcoders mailing list
[email protected]
http://chattyfig.figleaf.com/mailman/listinfo/flashcoders