Need quick Pol->Rec->Pol routine
Is there a nice quick (as in really quick) Polar to normal co-ordinates (and back again) routine?
I have written one with sqrt(sqrt(sqrt(sqrt(sqrt(sqrt( etc. but its too slow.
Why yes 
I''m using what I call "Siegielian" co-ordinates - the latitude (round the way) ranges from 0 to 2PI, and the longitude (up & down the way) from +1 to -1 (so 0 is the equator). You can easily scale these to your fancy.
So it''s not actually polar as in azimuth and elevation at all when I think about it... oh. Might not be what you actually wanted then!
Hope these help anyway...
The convention I use is phi for latitude, and z for longitude.
www.coldcity.com
code, pics, life

I''m using what I call "Siegielian" co-ordinates - the latitude (round the way) ranges from 0 to 2PI, and the longitude (up & down the way) from +1 to -1 (so 0 is the equator). You can easily scale these to your fancy.
So it''s not actually polar as in azimuth and elevation at all when I think about it... oh. Might not be what you actually wanted then!
Hope these help anyway...
The convention I use is phi for latitude, and z for longitude.
void GetUnitCartesianFromSiegelian (float z, float phi, GLfloat *result) { double theta = asin(z); result[0] = (float)(cos(theta) * cos(phi)); result[1] = (float)(cos(theta) * sin(phi)); result[2] = z;}void GetSiegelianFromUnitCartesian (GLfloat *point, float *z, float *phi) { *phi = (float)atan2(point[1], point[0]); *z = point[2];}
www.coldcity.com
code, pics, life
[size="2"]www.coldcity.com code, art, life
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement