   Sphere point to circle point
  I have a vector which can point to any coordinate on the top half of a unit sphere. The vector location is generated from accelerometer data. I am trying to project the position into a circle on a plane. Problem:I naively used a simple projection onto the x,y plane. As the vector approaches the x,y plane the distance traveled on the sphere surface does not correspond to the distance traveled on the x,y plane. My rusty math skills are showing. What I would like to do is project these points to a 'flattened' sphere. It would be nice if the point distance distribution was linear. For some reason I am coming up empty. I end up converting to cartesian which I do not want.Any pointers would be very helpful.Edit:<bad idea removed>[Edited by - smc on May 3, 2010 9:13:02 PM]
  I don't have a solution for you, but here's an idea that might be a little closer to what you're looking for than what you have now. (Note: all code examples are off the top and my head and untested.)First, convert the point on the hemisphere to spherical coordinates:float theta = 0;float l = sqrt(x * x + y * y);if (l > epsilon) {    theta = atan2(y, x);}float phi = pi_over_2 - atan2(z, l);Map phi to the range [0, 1]:float t = phi / pi_over_2;Generate the final x, y position using a polar coordinate conversion:circle_x = cos(theta) * t;circle_y = sin(theta) * t;Anyway, that's what first comes to mind, but maybe someone else can offer a better solution.[Edit: Fixed error in pseudocode.][Edited by - jyk on May 4, 2010 12:40:06 PM];  Thank you. This works very good. Mapping to PI_OVER_2 is all I needed to change.  ;Quote:Mapping to PI_OVER_2 is all I needed to change.Oops, fixed - not sure what I was thinking there :-|   