{ sphere.cal Copyright 1998, Mark J. Stock Coordinate mapping for image onto sphere assuming uniform projection of elevation/latitude and azimuth/longitude A1 = image height/width (hopefully 0.5) use globe_* to map onto a unit-radius sphere centered at the origin use inf_* to map to the inside of an infinite sphere } globe_u = if(A1-1, 1, 1/A1) * (.5 + Atan2(Py, Px)/(2*PI)) ; globe_v = if(A1-1, A1, 1) * (1 - Acos(Pz)/PI) ; inf_u = if(A1-1, 1, 1/A1) * (.5 + Atan2(Dy, Dx)/(2*PI)) ; inf_v = if(A1-1, A1, 1) * (1 - Acos(Dz)/PI) ;