On Fri, Apr 10, 2009 at 4:52 PM, Jer Brand <[email protected]> wrote: > Anyone care to school me on this or confirm the math is correct?
It looks correct to me. > public static function polarToCartesian3D(distance:Number, degrees1:Number, > degrees2:Number ):Point3D Ah, that's your problem right there -- your code converts /Spherical/ coordinates to Cartesian, not /Polar/ coordinates... :) Seriously, though, it's correct. The ever knowing Wikipedia agrees with you, too: <http://en.wikipedia.org/wiki/Spherical_coordinates#Cartesian_coordinate_system> However, your axis might not align to the coordinate system your code (and Wikipedia) assumes, which might explain unexpected but almost-right looking behaviour. I usually use X right, Y down and Z into the screen, because that seems like the natural way for screen coordinates. If that's what you're using, then you have to rearrange the math in your code accordingly, i.e, swap the x, y and z around to make it fit. If you want to get into that, I recommend you refresh your vector math skills and have another look at matrix math. You'll need that all the time. It's actually not that difficult, and it doesn't require anything but very basic prior math knowledge to get into. There are many vector math tutorials on the web. Finally, despite of Wikipedia and Math World, I still find those two ugly text based old skool Usenet FAQs invaluable: <http://www.j3d.org/matrix_faq/vectfaq_latest.html> <http://www.j3d.org/matrix_faq/matrfaq_latest.html> They'll answer pretty much any question you could possibly have. HTH, Mark _______________________________________________ Flashcoders mailing list [email protected] http://chattyfig.figleaf.com/mailman/listinfo/flashcoders

