Original Post
I got someone on a math forum to come up with a formula to convert a normal to a spherical coordinate from there I made it into c++ but I'm not sure it will work or if this is the best way so tell me how I can make it better or at least work? [Edited by - EmptyVoid on July 26, 2007 4:54:34 PM]
void Normal2Spherical(float x,float y,float z)
{
float radius, latitude, longitude
radius = sqrt((x*x) + (y*y) + (z*z));
latitude = arctan(y/x);
if(y<0 && x<0)
{
latitude += 180;
}
if(y>0 && x<0)
{
latitude += 180;
}
longitude = arccos(z/sqrt((x*x) + (y*y) + (z*z)))
}