# Change of coordinate system on a sphere

This might take a while to explain, so bear with me:

I've got a perfect sphere. I've set up an arbitrary longitude/latitude ("angle") coordinate system on it (imagine an equator around the middle, with an arbitrary (0,0) on the equator). The coordinates are angles (longitude from $-\pi$ to $\pi$, and latitude from $-\frac{\pi}{2}$ to $\frac{\pi}{2}$).

In order to visualize what I want to do, I came up with this way of thinking about it: Imagine a sheet of graph paper pinned (through the middle) to the sphere at the origin (0,0). The graph paper cannot be rotated. The lines on the graph paper form a "grid".

The graph paper can be wrapped around the equator with no distortion (forming a cylinder), but wrapping it completely around the sphere will force distortion around the poles (imagine the graph paper scrunching up to fit at the poles). This is expected. It turns out (I think) that the graph paper can be wrapped around any equator (with any arbitrary origin), so long as that equator includes the pinned point. Of course, wrapping it around a different equator will yield distortion at different poles (those relative to that equator), with no distortion at all along that equator.

Now, pick any point on the sphere (other than (0,0)) and call it the "local origin". I can wrap the graph paper around the sphere along the "global equator" and this gives me a "global coordinate system". I can also wrap the graph paper along the (unique) "local equator" that crosses both the global origin and local origin, yielding a "local coordinate system". Both have the same amount of distortion, but in different places.

The graph paper is in arbitrary units representing a fixed number of radians in the global coordinate system.

I've got a specific point which is expressed in the local coordinate system. Now, what I want to do is get the location of that point expressed in the global coordinate system. I tried a change of basis in the grid (yay!), but it turns out this doesn't work properly (aww) because the grid is warped differently in each coordinate system, so the grid units aren't equivalent in size anywhere except on the local equator (where there's no distortion).

I've thought of transforming the point from the local coordinate system into a (local) 3D $(x,y,z)$ point, then applying a transformation that would rotate it into its place in global 3D space, then working backward from that point to get the global angle coordinates. But that's kind of ugly (plus, I'm trying to keep the number of operations down since I'm using fixed-precision arithmetic).

Surely there's a simple way to go from local (angle) coordinates to global (angle) coordinates?

Thanks!

Update: Nope, I really don't believe there's a simpler way than converting to local 3D Cartesian coordinates, applying a transform to get global 3D coordinates, then going back to global angle coordinates. I could, of course, be wrong.

• To clarify what you know: let $L$ be the local origin, $O$ be the true origin; $N$ be the "North Pole" of the local coordinate system (i.e. $L\times O$ normalised); let $P'$ be the intersection of $LO$ with $NP$; you know the lat and long of $L$ in the global system, the (signed) distance $LP'$= local longitude, and the (signed) distance $PP'$= local latitude? – Peter Taylor May 19 '12 at 10:46
• @Peter: Hmm, I'm not sure I completely follow (my math is a bit rusty). I know $N$ in local coordinates (though I'm not sure what $L \times O$ would do -- since $L$ is (0,0) in local coordinates). The components of $P$ are already in local longitude and latitude -- I'm not sure what $LP'$ and $PP'$ would represent (though I could find their signed values, yes). $LN$ and $OL$ are orthogonal. Also, $LO$ and $NP$ may not intersect (they could be parallel). – Cameron May 19 '12 at 18:57
• $L \times O$ is intended to be a cross product in the Euclidean embedding, i.e. one of the two poles of which $LO$ is (part of) the polar. The descriptions of $LP'$ and $PP'$ are intended to clarify what you mean by local lat and long. $LO$ and $NP$ cannot possibly be parallel, because on the surface of a sphere two lines are parallel only if they are collinear, and $N$ is not on $LO$ by construction. – Peter Taylor May 21 '12 at 14:18
• @Peter: Ah, I think I misunderstood your comment. I thought you were talking about points on the grid ("unwrapped graph paper"), not on the sphere surface itself (in 3D coordinates). $N$ as $L \times O$ makes sense now :-) Yes, $LP'$ would be the longitude, but the latitude would be the distance from $P$ to $OL$ (not $PP$). But, it turns out that I didn't think things through, and I really don't need this any more. In any case, I don't think there's a shorter way than converting to 3D Cartesian coordinates, applying a transform, then going to global angles. Thank you for taking an interest! – Cameron May 22 '12 at 4:26