<-- Return to Excel Statistics Page
Three Dimensional (3D) Rotation via Matrix Multiplication
Keith Greiner
August 9, 2020
This essay is about how to rotate data in 3D. It is intended to be a follow-up to the document at this address that is about rotating data in a 2D space.
The words “range”, “array”, and “matrix” all mean the same thing.
Here, I will denote the ranges, and arrays in capitol letters.
D is the original data in the range C10:E59
R with, numbers appended, denotes the four rotation ranges
R1 holds the x axis constant and is at G12:I14
R2 holds the y axis constant and is at G17:I19
R3 holds the z axis constant and is at G22:I24
RA rotates all axes and is at G27:I29
Results are in output matrices…
O1 holds the results of x axis constant and is at K10:M59
O2 holds the results of y axis constant and is at O10:Q59
O3 holds the results of z axis constant and is at S10:U59
OA holds the results when all axes are rotated and is at W10:Y59
The degrees of rotation are in cell H5 and the radians are in cell H6
The contents of R1 through RA are shown below, when the degrees of rotation are set to 30.
The following Excel Image shows the contents of the rotation matrices. Be sure to note the cells that have minus signs before the = -SIN(…) function. They may not be fully visible.
The following image shows a screen print of the first 53 lines of the setup. Double-click on the image for a closer look.
Using the matrix notation described above,
O1 = D * R1
O2 = D * R2
O3 = D * R3
OA = D * RA
Where the multiplication character indicates use of the Excel =MMULT(Range1, Range2) function.
Graphing the 3D Image
Unfortunately, Excel does not have the ability to graph points of a scatter gram in three dimensions (as of August, 2017) so I used the next best tool available, and that was Apple Grapher.app. The image shown below shows a set of points rotated with the z-axis held constant, while data points for x and y were rotated 30 degrees.
To accomplish this, I followed these steps.
To ensure that the x, y, and z axes can always be seen, create three points sets. One has sequential numbers from -1 to +1 in the x column and zeros in the other columns. Do the same for the y and z points. Import these three data sets and they will show up on the x, y, and z axes. Color code them to make sure you always know which axis is which.
-30-