1
$\begingroup$

I have a set of points in an equatorial coordinate system specified by a longitude, $0^{\circ}\leq\alpha < 360^{\circ}$ and a latitude, $-90^{\circ}\leq \delta \leq +90^{\circ}$

I want to take a point with coordinates $(\alpha_1,\delta_1)$ and create a second coordinate system such that my point now has coordinates $(\alpha_2,\delta_2)$. I then want to apply that transformation to every point in the set.

Shifting in longitude with constant latitude is straightforward, the transformation is just $(\alpha,\delta)\rightarrow(\alpha+\alpha_2-\alpha_1,\delta)$, but shifting in latitude is more complicated due to behaviour around the poles.

There's a similar question here that rotates the equator of the coordinate system to intersect with the point while preserving the points longitude (i.e. shifting latitude with constant longitude). There is definitely a way to generalise the top answer to that question so that it solves my problem, I just can't seem to figure it out.

I can imagine a series of transformations such that I shift $(\alpha_1,\delta_1)$ to $(0,\delta_1)$ using the longtitude transformation I mention above, then use the solution to the other question to shift that to $(0,0)$, then use an inverse transformation to shift it to $(0,\delta_2)$ and then finally a simple longitude transformation to shift it to $(\alpha_2,\delta_2)$.

However, that sounds like an overly complicated solution.

There should (hopefully!) be a way to do it with a single coordinate transformation, which would be preferable since I have to write this in Python and more transformations means more compute time. I'll be calculating and applying this transformation ~10,000 times to approximately 10 million points, so needlessly increasing the number of calculations has big flow-on effects.

$\endgroup$
  • $\begingroup$ I would step back and examine why you want to do this. I think the question you linked to made assumptions that made the problem harder; perhaps you are doing that too. $\endgroup$ – David K Jul 26 '18 at 3:01
1
$\begingroup$

A transformation from one coordinate system on the sphere to another one can be represented by a rotation about the centre of the sphere. The rotations about a point form a group. Thus, composing any two rotations again yields a rotation. Thus, you don't have to worry about the number of rotations you use to perform the transformation; you can express them all as matrices and multiply all the matrices to get a single matrix to apply. Then you can transform your points to Cartesian coordinates, apply the one matrix and transform them back to spherical coordinates.

The sequence of transformations you describe is one good way to solve the problem, by representing the rotation as the product of three rotations about coordinate axes. You can also construct a single rotation directly if you prefer. There's a continuum of rotations that transform a given point into a given other point; any axis that's equidistant from the two points will do. The two ends of this continuum are easier to construct than the rest. Transform the points to vectors in Cartesian coordinates. To rotate through the least possible angle, take the cross product as the axis and the angle between the vectors as the angle. To rotate through the greatest possible angle, take the midpoint (half the sum) as the axis and $\pi$ as the angle. See Rodrigues' rotation formula on how to build a rotation matrix given an axis and an angle.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.