Processing math: 100%

How to Convert one Set of Spherical Coordinates to Another?


BlogMathematics of the Celestial SphereSpherical Geometry
rotation matrices

May 7, 2024, 9:10 p.m. Advanced Alexey Borealis 5 min. to read


In the previous article on basic trigonometry for astrologers, we derived formulas for converting spherical coordinates to Cartesian ones. In this article, we will get acquainted with the equations for the coordinate conversion from one spherical coordinate system to another. It will help us solve the previously stated task of converting ecliptic coordinates to equatorial, which is necessary for calculating primary directions.

Cartesian Vector

First, we need to convert the spherical angles of the celestial object to cartesian coordinates with equation (2) from the previous article. We will perform all the conversions in cartesian coordinates.

For convenience, we introduce the idea of cartesian vector as a pointer to an object in the XYZ coordinate system.

Vector has

  • starting point with coordinates (0,0,0)
  • endpoint with coordinates (x,y,z) that coincides with the object's location.

We will denote the vector by the letter v and write its direction in the following form:

v=xX+yY+zZ

In the latter notation, we mean that the vector has an extent of X units in the direction of the X-axis, an extent of Y units along the Y-axis and the same for Z.

Rotation of the Coordinate System

What happens if we rotate the coordinate system by the angle α in XY plane?

X Y α α x y y' x' X rot Y rot v

In the initial XYZ system vector has coordinates (x,y), but in a new (rotated) system, it has coordinates (x,y,z), i.e.

v=xXrot+yYrot+zZrot

Let's consider an X part of the vector v, namely, xX. It is a pointer to the x coordinate.

α x Y rot X rot x cos(α) x sin(α)

We can project this pointer (i.e., vector) to the Xrot and Yrot axes. We remember from (1) of the previous article that these projections are xcosα and xsinα. So we can write:

хX=xcosα Xrotxsinα Yrot

In the same way

yY=ysinα Xrot+ycosα Yrot

We do not change the Z-axis, so zZ=zZrot. Putting it all together, we have:

v=(xcosα+ysinα)Xrot+(xsinα+ycosα)Yrot+zZrotv=xXrot+yYrot+zZrot

It means that:

{x=xcosα+ysinαy=xsinα+ycosαz=z

For the reverse conversion we need to change α to α, which gives:

{x=xcosαysinαy=xsinα+ycosαz=z

Sine and Cosine of Two Angles

From (2), it follows a vital equation. Lets denote spherical longitude in XrotYrot plane by β, i.e.

{x=cos(α+β)y=sin(α+β)x=cosβy=sinβ

X Y α x y y' x' X rot Y rot v β

Then we immediately get the equations for the sine and cosine of the sum of two angles:

cos(α+β)=cosαcosβsinαsinβ sin(α+β)=sinαcosβ+sinβcosα

Rotation Matrices

Let’s return to formula (2). This time we write it more implicitly:

{x=cosα×x+sinα×y+0×zy=sinα×x+cosα×y+0×zz=0×v+0×y+1×z

We have a repeating pattern — we sequentially multiply the x, y, and z coordinates by specific coefficients in the first, second, and third rows and then sum the product of these multiplications.

We can separately list these coefficients of the 1st, 2nd, and 3rd rows in square brackets and express the same idea more concisely:

(x y z)=[cosαsinα0 sinαcosα0 001]×(x y z)

It is a more convenient representation of these three equations, but this compactness will make our lives easier. We pronounce it like this: If we multiply the coordinates x, y, and z by these coefficients, then we will get the new coordinates of the vector in the coordinate system rotated at an angle α.

These coefficients are commonly referred to as the rotation matrix, and the expression above is the multiplication of the coordinates (x,y,z) by the rotation matrix, which gives new coordinates (x,y,z).

For rotation in the XY plane on angle α we use the following matrix

A=[cosαsinα0sinαcosα0001]

A is the rotation matrix in the XY plane, i.e., a 2-dimensional array of coefficients to be multiplied with coordinates.

For the inverse conversion, we change α to α, which gives an inverted matrix symmetrical to the original:

AT=[cosαsinα0sinαcosα0001]

In the same way, the rotation matrices for rotation in XZ and YZ planes are:

AXZ=[cosα0sinα 010 sinα0cosα]

AYZ=[1000cosαsinα0sinαcosα]

Multiple Rotations

This concise notation for translating cartesian coordinates through rotation matrices gives us a significant advantage. Now, we can efficiently perform multiple sequential rotations in different planes and express them with a straightforward formula.

Suppose we want to rotate the coordinate system by an angle α along the XY plane and then rotate the new coordinate system by an angle β along the XZ plane. First, we obtain the vector’s coordinates after rotation by angle α:

(xyz)=A×(xyz)

Then we rotate this vector by angle β in the second plane:

(xyz)=B×(xyz)

We can express this even more simply:

(xyz)=B×A×(xyz)

As you can see, we simply multiply the matrices in the required sequence. Here, the first rotation matrix, according to (4), is:

A=[cosαsinα0sinαcosα0001]

And the second rotation matrix, according to (5), is:

B=[cosβ0sinβ010sinβ0cosβ]

As you can see, we can write translations from one coordinate system to another very compactly.

Voila, we have coordinates of the initial vector in a new coordinate system. What we have to do eventually is to convert new cartesian coordinates into spherical angles in the rotated coordinate system.

To do this, we will use equation (2) from the previous article.

Bottom Line

You are now familiar with vector objects and rotation matrices.

You also know that the general approach to converting one spherical system to another consist of 3 steps.

Step 1

Covert spherical angles to cartesian coordinates with equation (2) from the previous article. We denote cartesian coordinates by (x,y,z)

Step 2

Rotate the coordinate system by angle α and then by β and express cartesian coordinates in a new (rotated) system:

(xyz)=B×A×(xyz)

Step 3

Finally, convert cartesian coordinates (x,y,z) to spherical angles with equation (2) from the previous article.


Alexey Borealis

Alexey Borealis

Master of Science in Physics, Professional astrologer (MAPAI). About the author

This Site uses cookies. By browsing it, you agree with our Cookie Policy.