﻿ Rotations on a Sphere

# Rotations on a Sphere

Steven Dutch, Natural and Applied Sciences, University of Wisconsin - Green Bay
First-time Visitors: Please visit Site Map and Disclaimer. Use "Back" to return here.

Rotations around some arbitrary axis are essential for any computer study of plate tectonics, but it can be astonishingly hard to find out how to do it. Since the mathematics were worked out long ago, most books on plate tectonics simply refer readers to mathematics texts, but since this is not a very widely-used operation, mathematics texts and references tend to omit it.

## Needed Data

In order to describe a rotation on a sphere, we need to know the location of the rotation axis and the rotation angle. We will find it most useful to describe the rotation axis in terms of its x-, y- and z- coordinates. Call the x-, y- and z- coordinates of the axis c1, c2 and c3, respectively. For simplicity we will do everything on a unit sphere; if we need real-world values we can multiply the final results by the actual radius of the sphere. On a unit sphere:

c12 + c22 + c32 = 1

### Converting to Cartesian Coordinates

• If the rotation axis is located in terms of latitude and longitude (north latitude and east longitude are positive):
• c1=cos(lat)cos(long)
• c2=cos(lat)sin(long)
• c3=sin(lat)
• If the rotation axis is located in terms of spherical coordinates a and p, where az is azimuth and phi is the angle from the z-axis:
• c1=cos(az)sin(phi)
• c2=sin(az)sin(phi)
• c3=cos(phi)

All the points rotated will also be described in terms of their three-dimensional coordinates. Use the formulas above to convert the coordinates of those points to Cartesian coordinates as well.

## Matrix Notation

We are going to transform points (x,y,z) to new coordinates (x',y',z') using formulas:

• x' = a1x + b1y + c1z
• y' = a2x + b2y + c2z
• z' = a3x + b3y + c3z

Since this sort of thing happens so frequently in mathematics, a shorthand notation for it has been developed called matrix algebra. We can write the coefficients a1, b1 ... c3 in a square array. The operation of matrix multiplication is defined thus:

```              |a1 b1 c1||x|
(x',y',z') = |a2 b2 c2||y|
|a3 b3 c3||z|
```

To find x', take each term in the first row of the array, multiply it by the corresponding term in the original coordinate array (written vertically) and sum the result. That is, x' = a1x + b1y + c1z. We do the same thing for the y' and z' terms.

Multiplying a matrix by a constant or expression simply means multiplying everything in the matrix by the same term. Adding matrices means adding the terms.

```  |a1 b1 c1|   |ka1 kb1 kc1|
k|a2 b2 c2| = |ka1 kb1 kc1|  and
|a3 b3 c3|   |ka1 kb1 kc1|

|a1 b1 c1| |d1 e1 f1|   |a1+d1 b1+e1 c1+f1|
|a1 b1 c1|+|d1 e1 f1| = |a2+d2 b2+e2 c2+f2|
|a1 b1 c1| |d1 e1 f1|   |a3+d3 b3+e3 c3+f3|
```

For a simple 3 x 3 matrix, matrix notation may not seem like much of an improvement over just writing the equations. But for more complex situations, the improvement can be pretty substantial. However, my personal opinion is that, for situations where the user is going to have to write the equations in a program anyway, authors do a disservice (call it laziness) by simply stopping at the matrix forms.

## Sum-of-Matrices Form

Let the coordinates of the rotation axis be (c1,c2,c3) and the rotation angle be a. Any point (x,y,z) will be rotated into new coordinates (x',y',z') by the following matrix:

```      |1 0 0|              |c1c1 c1c2 c1c3|        |  0 -c3  c2|
cos a|0 1 0| + (1 - cos a)|c2c1 c2c2 c2c3| + sin a| c3   0 -c1|
|0 0 1|              |c3c1 c3c2 c3c3|        |-c2  c1   0|
```

In the middle term the coefficients are written c1c1, c2c2 and c3c3 partly to avoid exponents but also to show the pattern of the terms more clearly.

## Cayley-Klein (Quaternion) Form

This form starts off with terms that are a bit more complex but leads to a simpler single matrix. We define k = c1 sin a/2, m = c2 sin a/2, n = c3 sin a/2, p = cos a/2. Note that:

```                 2    2    2    2
k  + m  + n  + p  = 1
```

The rotation matrix is:

```           | 2  2  2  2                         |
|k -m -n +p    2(km-np)    2(nk+mp)  |
|                                    |
|              2  2  2  2            |
| 2(km-np)    m -m -m +p   2(mn-kp)  |
|                                    |
|                          2  2  2  2|
| 2(nk-mp)     2(mn+kp)   m -m -m +p |
```

## The Equations

• x' = x cos a + (1 - cos a)(c1c1x + c1c2y + c1c3z) + (c2z - c3y)sin a
• y' = y cos a + (1 - cos a)(c2c1x + c2c2y + c2c3z) + (c3x - c1z)sin a
• z' = z cos a + (1 - cos a)(c3c1x + c3c2y + c3c3z) + (c1y - c2x)sin a

## Sum of Two Rotations

Here's where matrix algebra has an advantage. If we have two rotations, each represented as a matrix, the result of both rotations is the product of their two matrices. If, for example, you're doing a plate tectonic reconstruction where one source gives you the North America-Pacific rotation, and another gives you the North America-Eurasia rotation, you may want to determine the rotation between Eurasia and the Pacific.

• Rotation 1: Pole at latitude L1, longitude W1, Rotation angle A1. Define:
• a1 = cos A1/2
• b1 = sin A1/2 cos L1 cos W1
• c1 = sin A1/2 cos L1 sin W1
• d1 = sin A1/2 sin L1
• Rotation 2: Pole at latitude L2, longitude W2, Rotation angle A2. Define:
• a2 = cos A2/2
• b2 = sin A2/2 cos L2 cos W2
• c2 = sin A2/2 cos L2 sin W2
• d2 = sin A2/2 sin L2

The formulas for b, c, and d are just the formulas for converting latitude and longitude to Cartesian coordinates, but we need a different notation here because we have to distinguish two sets of coordinates. The result of the two rotations is:

• a = a1a2 - b1b2 - c1c2- d1d2
• b = (a1b2 + a2b1) + (c2d1 - c1d2)
• c = (a1c2 + a2c1) + (d2b1 - d1b2)
• d = (a1d2 + a2d1) + (b2c1 - b1c2)

We have a rotation with pole at latitude L, longitude W, Rotation angle A, and:

• a = cos A/2
• b = sin A/2 cos L cos W
• c = sin A/2 cos L sin W
• d = sin A/2 sin L

Thus:

• A = 2 arccos a
• L = arcsin (d/sin A/2)
• W = arctan (c/b)