Generalised change of spherical coordinates

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
1
down vote

favorite
1












I have a set of points in an equatorial coordinate system specified by a longitude, $0^circleqalpha < 360^circ$ and a latitude, $-90^circleq 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.







share|cite|improve this question



















  • 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.
    – David K
    Jul 26 at 3:01














up vote
1
down vote

favorite
1












I have a set of points in an equatorial coordinate system specified by a longitude, $0^circleqalpha < 360^circ$ and a latitude, $-90^circleq 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.







share|cite|improve this question



















  • 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.
    – David K
    Jul 26 at 3:01












up vote
1
down vote

favorite
1









up vote
1
down vote

favorite
1






1





I have a set of points in an equatorial coordinate system specified by a longitude, $0^circleqalpha < 360^circ$ and a latitude, $-90^circleq 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.







share|cite|improve this question











I have a set of points in an equatorial coordinate system specified by a longitude, $0^circleqalpha < 360^circ$ and a latitude, $-90^circleq 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.









share|cite|improve this question










share|cite|improve this question




share|cite|improve this question









asked Jul 25 at 2:56









DDobie

61




61











  • 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.
    – David K
    Jul 26 at 3:01
















  • 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.
    – David K
    Jul 26 at 3:01















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.
– David K
Jul 26 at 3:01




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.
– David K
Jul 26 at 3:01










1 Answer
1






active

oldest

votes

















up vote
0
down vote













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.






share|cite|improve this answer





















    Your Answer




    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("mathjaxEditing", function ()
    StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix)
    StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
    );
    );
    , "mathjax-editing");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "69"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    convertImagesToLinks: true,
    noModals: false,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    noCode: true, onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );








     

    draft saved


    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2861978%2fgeneralised-change-of-spherical-coordinates%23new-answer', 'question_page');

    );

    Post as a guest






























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes








    up vote
    0
    down vote













    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.






    share|cite|improve this answer

























      up vote
      0
      down vote













      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.






      share|cite|improve this answer























        up vote
        0
        down vote










        up vote
        0
        down vote









        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.






        share|cite|improve this answer













        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.







        share|cite|improve this answer













        share|cite|improve this answer



        share|cite|improve this answer











        answered Jul 25 at 5:07









        joriki

        164k10180328




        164k10180328






















             

            draft saved


            draft discarded


























             


            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f2861978%2fgeneralised-change-of-spherical-coordinates%23new-answer', 'question_page');

            );

            Post as a guest













































































            Comments

            Popular posts from this blog

            What is the equation of a 3D cone with generalised tilt?

            Color the edges and diagonals of a regular polygon

            Relationship between determinant of matrix and determinant of adjoint?