0% found this document useful (0 votes)
150 views12 pages

Euler and Quaternion Rotation 11

The document discusses two methods for calculating the 3D rotation of a camera in a flight simulator application using Google Earth: quaternion rotation and Euler rotation. Both methods take as input the aircraft attitude from the flight simulator and the camera swivel angles, perform a compound rotation calculation, and output the heading, tilt, and roll angles needed for Google Earth. The quaternion method uses quaternion algebra while the Euler method uses rotation matrices. Detailed equations are provided for converting between Euler angles and quaternions/matrices and performing the compound rotations for both methods.

Uploaded by

Silly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
150 views12 pages

Euler and Quaternion Rotation 11

The document discusses two methods for calculating the 3D rotation of a camera in a flight simulator application using Google Earth: quaternion rotation and Euler rotation. Both methods take as input the aircraft attitude from the flight simulator and the camera swivel angles, perform a compound rotation calculation, and output the heading, tilt, and roll angles needed for Google Earth. The quaternion method uses quaternion algebra while the Euler method uses rotation matrices. Detailed equations are provided for converting between Euler angles and quaternions/matrices and performing the compound rotations for both methods.

Uploaded by

Silly
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 12

3D Rotation for Flight Simulator - Google Earth Application

R.P. McElrath, October, 2015

Camera rotation for the Flight Simulator - Google Earth (G.E.) swivel cam application can be computed
using either Quaternion or Euler rotation algorithms.

Input data are the same for either method: 1) Euler angle triplet from Flight Simulator (A:PLANE HEADING
DEGREES TRUE, A:ATTITUDE INDICATOR PITCH DEGREES, A:ATTITUDE INDICATOR BANK DEGREES) plus
2) Euler triplet of the camera swivel (Yaw, Tilt, Roll) via input from the HAT or POV switch on a joystick
that returns camera view angles relative to the current aircraft axes (e.g., “look left”).

The required output is the Heading-Tilt-Roll Euler angle triplet needed to aim the Google Earth camera
relative to the fixed world reference frame that G.E. uses.

The rotation process steps are:

1) Convert the input Euler angle triplets to either two Quaternions or two Euler Rotation Matrices

2) Calculate the compound (or concatenated or stacked) rotation through a rotation multiplication
process (Quaternion Hamilton multiplication or Euler Rotation Matrix multiplication)

3) Convert the resulting multiplication back to Euler Heading, Tilt, and Roll angles

This paper assumes Euler angles are in Tait-Bryan Yaw, Pitch, and Roll form. The rotations are intrinsic
and active (alibi) and the rotation order is z then y then x.

Equations presented here fit the coordinate system conventions of Flight Simulator (left hand Cartesian
coordinate system and rotations) and Google Earth (mixed coordinate system). The equations will differ
from those published in other sources if different conventions are used.

1
Quaternion Rotation

Convert Euler (Tait-Bryan) Angles to a Quaternion

 w v u  w v u


q0 = cos   cos   cos   + sin   sin   sin   (1a)
2 2 2  2  2 2

 w v u  w v u


q1 = sin   cos   cos   − cos   sin   sin   (1b)
2 2 2  2  2 2

 w v u  w v u


q2 = cos   sin   cos   + sin   cos   sin   (1c)
 2  2 2 2 2 2

 w v u  w v u


q3 = cos   cos   sin   − sin   sin   cos   (1d)
2 2 2  2  2 2

where:

u = roll angle. Flight Simulator u = Bank Swivel Camera u = Roll


v = pitch angle. Flight Simulator v = Pitch Swivel Camera v = Tilt
w = yaw angle. Flight Simulator w = Heading Swivel Camera w = Yaw

Compound Rotation: Quaternion Multiplication

The compound (concatenated) rotation, Flight Simulator Heading-Pitch-Bank rotation followed by Camera
Yaw-Tilt-Roll swivel, is also represented by a quaternion. The compound rotation quaternion (t) is
calculated by quaternion multiplication:

t = Flight Simulator H-P-B quaternion (r) * Camera Y-T-R quaternion (s)

(t0, t1, t2, t3) = (r0, r1, r2, r3) * (s0, s1, s2, s3)

where t is the Hamilton product whose coefficients are:

t0 = (r0s0 − r1s1 − r2s2 − r3s3) (2a)

t1 = (r0s1 + r1s0 − r2s3 + r3s2) (2b)

t2 = (r0s2 + r1s3 + r2s0 − r3s1) (2c)

t3 = (r0s3 − r1s2 + r2s1 + r3s0) (2d)

Quaternion coefficients r0, r1, r2, r3 and s0, s1, s2, s3 are calculated using equations 1 a-d. For Flight
Simulator, rn = qn. For the swivel camera, sn = qn.

2
Convert Quaternion to Euler (Tait-Bryan) Angles

TILT: −1*asin[ 2*( t0*t2 − t1*t3 ) ] (3)

ROLL: atan2[ t02 + t12 − t22 − t32 , 2*( t0* t3 + t1* t2 ) ] (4)

HDG : atan2[ t02 − t12 − t22 + t32 , 2*( t0* t1 + t2* t3 ) ] (5)

To prevent #NUM! Out of Range errors if using Excel, TILT should include a ROUND function, e.g.,
−1*asin[ 2*( ROUND( t0*t2 − t1*t3 , 13 ) ) ] with num_digits greater than zero. 13 is a good choice.

Mathematic Singularity (“Gimbal Lock”)

Quaternions are immune from the phenomenon of “gimbal lock”; however, Euler angles are not. The
issue is a mathematical singularity occurring when TILT equals ± 90.0° and the ROLL and HDG equations
both equal atan2( 0, 0 ) and are therefore invalid.

To mitigate the singularity at ± 90° TILT:

TILT (as derived from t): −1*asin[ 2*( t0*t2 - t1*t3 ) ] (no change)

ROLL (at TILT = ±90°): ≡ 0°

HDG (at TILT = +90°): = −2*atan2( t1, t0 )


HDG (at TILT = −90°): = 2*atan2( t0, t1 )

The singularity can either be ignored*, or equations (4) and (5) modified to conditionally account for it.
Actually, it would be quite rare for equation (3) to yield exactly ±90° in the first place, and if it does, then
on the next Flight Simulator gauge update cycle (~56 ms later), it’s very likely to no longer be ±90° and
everything is back to normal.

Google Earth Tilt

Lastly, the Google Earth Tilt range convention is addressed by adding 90° to results of equation (3):

GE Tilt = TILT + 90° (6)

Unlike Flight Simulator Pitch, Google Earth Tilt ranges from 0° to +180°, with no negative values. In
Google Earth, a Tilt of 0° looks down, 90° is in the x-y plane, and +180° is in the ‘sky’. In level flight, Flight
Simulator returns a Pitch of near 0°, but to Google Earth, 0° Tilt points the camera down. Consequently,
to achieve the pilot’s perspective of looking forward rather than down, 90° should be added to TILT from
equation (3).

Equations 4, 5, and 6 are used for the Google Earth view as Flight Simulator is running. The full set of
equations needed is 1a-d for the Flight Sim quaternion, 1a-d for the Camera quaternion, 2a-d for the
Flight Sim-Camera Hamilton product, and 4, 5, and 6 for the final Google Earth Hdg, Tilt, and Roll angles.

3
Euler Rotation

Convert Euler (Tait-Bryan) Angles to a Rotation Matrix

The Elemental rotation matrices are:

1 0 0
R x (u) = 0 c(u ) −s(u )
0 s(u ) c(u )

c(v ) 0 s(v )
R y (v) = 0 1 0
−s(v ) 0 c(v )

c(w ) −s(w ) 0
R z (w) = s(w ) c(w ) 0
0 0 1

where:

u = roll angle Flight Simulator u = Bank Swivel Camera u = Roll


v = pitch angle Flight Simulator v = Pitch Swivel Camera v = Tilt
w = yaw angle Flight Simulator w = Hdg Swivel Camera w = Yaw

c( ) = cosine function and s( ) = sine function

The resulting Rotation Matrix is the product of the Elemental matrices:

Rz(w) * Ry(v) * Rx(u)

All are 3 X 3 matrices, so the matrix multiplication produces a 3 X 3 matrix:

c(v )c(w ) s(u )s(v )c(w ) − c(u )s(w ) s(u )s(w ) + c(u )s(v )c(w )
R z (w) R y (v) R x (u) = c(v )s(w ) c(u )c(w ) + s(u )s(v )s(w ) c(u )s(v )s(w ) − s(u )c(w )
−s(v ) s(u )c(v ) c(u )c(v )

Matrix multiplication order is important: Rz(w) * Ry(v) * Rx(u). In Excel, it would be written

=MMULT(Rz(w),MMULT(Ry(v), Rx(u)))

where Rz(w), Ry(v), and Rx(u) are replaced by the 3 row by 3 column range definitions (e.g., A1:C3) for
each Elemental matrix.

4
Compound Rotation: Rotation Matrix Multiplication

The objective Google Earth camera orientation is a combination of two sequential rotation sets:

1) Flight Simulator aircraft attitude followed by


2) Camera swivel relative to the aircraft axes

The Rotation Matrices involved are:

Flight Sim Attitude: RFS = Rz(Hdg) * Ry(Pitch) * Rx(Bank)


Camera Swivel: RCAM = Rz(Yaw) * Ry(Tilt) * Rx(Roll)

The compound, or concatenated, rotation is calculated by rotation matrix multiplication:

RFS×CAM = RFS * RCAM (10)

or, equivalently, expressed as the product of the individual Elemental rotation matrices:

RFS×CAM = Rz(Hdg) * Ry(Pitch) * Rx(Bank) * Rz(Yaw) * Ry(Tilt) * Rx(Roll)

This also results in a 3 X 3 matrix. The matrix elements are labeled as

r 11 r 12 r 13

R FS ×CAM = r 21 r 22 r 23

r 31 r 32 r 33

Matrix multiplication of equation (10) yields the following elements that are provided in the event the
user’s software doesn’t include an adequate matrix or vector library.

NOTE: In the equations below, Hdg, Pitch, Bank, and Yaw, Tilt, Roll are the angles used in the Elemental
rotation matrices, equations (7), (8), and (9). They should not be confused with the compound Google
Earth angles of equations (11), (12), and (13).

For clarity, “negative sine” is shown as −1*sin( ).

5
r11 = cos(Pitch) * cos(Hdg) * cos(Tilt) * cos(Yaw) + cos(Tilt) * sin(Yaw) * sin(Bank) * sin(Pitch) *
cos(Hdg) − cos(Tilt) * sin(Yaw) * cos(Bank) * sin(Hdg) − sin(Tilt) * sin(Bank) * sin(Hdg) − sin(Tilt) *
cos(Bank) * sin(Pitch) * cos(Hdg)

r12 = cos(Pitch) * cos(Hdg) * sin(Roll) * sin(Tilt) * cos(Yaw) − cos(Pitch) * cos(Hdg) * cos(Roll) * sin(Yaw) +
sin(Bank) * sin(Pitch) * cos(Hdg) * cos(Roll) * cos(Yaw) + sin(Bank) * sin(Pitch) * cos(Hdg) * sin(Roll) *
sin(Tilt) * sin(Yaw) − cos(Bank) * sin(Hdg) * cos(Roll) * cos(Yaw) − cos(Bank) * sin(Hdg) * sin(Roll) *
sin(Tilt) * sin(Yaw) + sin(Bank) * sin(Hdg) * sin(Roll) * cos(Tilt) + cos(Bank) * sin(Pitch) * cos(Hdg) *
sin(Roll) * cos(Tilt)

r13 = cos(Pitch) * cos(Hdg) * sin(Roll) * sin(Yaw) + cos(Pitch) * cos(Hdg) * cos(Roll) * sin(Tilt) * cos(Yaw) +
sin(Bank) * sin(Pitch) * cos(Hdg) * cos(Roll) * sin(Tilt) * sin(Yaw) − sin(Bank) * sin(Pitch) * cos(Hdg) *
cos(Roll) * sin(Tilt) * sin(Yaw) − cos(Bank) * sin(Hdg) * cos(Roll) * sin(Tilt) * sin(Yaw) + cos(Bank) *
sin(Hdg) * sin(Roll) * cos(Yaw) + sin(Bank) * sin(Hdg) * cos(Roll) * cos(Tilt) + cos(Bank) * sin(Pitch) *
cos(Hdg) * cos(Roll) * cos(Tilt)

r21 = cos(Pitch) * sin(Hdg) * cos(Tilt) * cos(Yaw) + cos(Tilt) * sin(Yaw) * cos(Bank) * cos(Hdg) +


cos(Tilt) * sin(Yaw) * sin(Bank) * sin(Pitch) * sin(Hdg) − sin(Tilt) * cos(Bank) * sin(Pitch) * sin(Hdg) +
sin(Tilt) * sin(Bank) * cos(Hdg)

r31 = −1*sin(Pitch) * cos(Tilt) * cos(Yaw) + sin(Bank) * cos(Pitch) * cos(Tilt) * sin(Yaw) + cos(Bank) *


cos(Pitch) * −1*sin(Tilt)

r32 = −1*sin(Pitch) * sin(Roll) * sin(Tilt) * cos(Yaw) − cos(Roll) * sin(Yaw) * −1*sin(Pitch) + sin(Bank) *


cos(Pitch) * cos(Roll) * cos(Yaw) + sin(Bank) * cos(Pitch) * sin(Roll) * sin(Tilt) * sin(Yaw) + cos(Bank) *
cos(Pitch) * sin(Roll) * cos(Tilt)

r33 = −1*sin(Pitch) * sin(Roll) * sin(Yaw) − sin(Pitch) * cos(Roll) * sin(Tilt) * cos(Yaw) + sin(Bank) *


cos(Pitch) * cos(Roll) * sin(Tilt) * sin(Yaw) − sin(Bank) * cos(Pitch) * sin(Roll) * cos(Yaw) + cos(Bank) *
cos(Pitch) * cos(Roll) * cos(Tilt)

Convert Rotation Matrix to Euler (Tait-Bryan) Angles

The compound rotation angles required to properly orient the Google Earth swivel camera while the
aircraft is flying are derived from the RFS×CAM rotation matrix:

TILT: v = sin-1( r31 ) = asin( r31 ) (11)

ROLL: u = tan-1( r33 / r32 ) = atan2( r33 , r32 ) (12)

HDG: w = tan-1( r11 / r21 ) = atan2( r11 , r21 ) (13)

6
Mathematic Singularity (“Gimbal Lock”)

Rotation Matrices are immune from the phenomenon of “gimbal lock”; however, Euler angles are not.
The issue is a mathematical singularity occurring when r31 = ±1 and r11 = r21 = r32 = r33 = 0 which yields a TILT
value of ± 90.0°, but the ROLL and HDG equations both equal atan2( 0, 0 ) and are therefore invalid.

To mitigate the singularity at ± 90° TILT:

TILT (as derived from RFS×CAM): = asin( r31 ) (no change)

ROLL (at TILT = ±90°): ≡ 0°

HDG (at TILT = +90°): = atan2( r13, r12 )


HDG (at TILT = -90°): = −1*atan2( r13, r12 )

The singularity can either be ignored*, or equations (12) and (13) modified to conditionally account for it.
Actually, it would be quite rare for equation (11) to yield exactly ±90° in the first place, and if it does, then
on the next Flight Simulator gauge update cycle (~56 ms later), it’s very likely to no longer be ±90° and
everything is back to normal.

* In hundreds of aerobatic Loops recorded at the default 18 hz gauge update cycle rate, never has Flight
Simulator returned ±90.00° for A:ATTITUDE INDICATOR PITCH DEGREES. Naturally in a Loop, the
pitch A:Vars returned by Flight Simulator approach ±90°, within tenths or, at best and very infrequently,
within hundredths of a degree, but never precisely equal ±90.00°.

On the other hand, ROLL and HDG Euler angles calculated from equations (4) and (5) or (12) and (13) are
stable at TILT values extremely close (but not equal) to ±90°, without applying the singularity mitigation
formulas. For example, TILT = 89.99999999999° or 90.00000000001° both yield stable and accurate
values of ROLL and HDG from equations (4) and (5) or (12) and (13) without applying the singularity
solutions.

The conclusion is that Flight Simulator may never return a Pitch value that causes a gimbal lock problem
with the G.E. rotations, even considering the compound rotation operation. This is why it’s probably
acceptable to ignore the singularity issue in this application.

Google Earth Tilt

Lastly, the Google Earth Tilt range convention is addressed by adding 90° to results of equation (11):

GE Tilt = TILT + 90° (14)

Unlike Flight Simulator Pitch, Google Earth Tilt ranges from 0° to +180°, with no negative values. In
Google Earth, a Tilt of 0° looks down, 90° is in the x-y plane, and +180° is in the ‘sky’. In level flight, Flight
Simulator returns a Pitch of near 0°, but to Google Earth, 0° Tilt points the camera down. Consequently,
to achieve the pilot’s perspective of looking forward rather than down, 90° should be added to TILT from
equation (11).

Equations 12, 13, and 14 are used for the Google Earth view as Flight Simulator is running.

7
Six Degrees of Freedom

Flight Simulator and Google Earth camera views require definition of all six degrees of freedom (DOF):
three rotational DOF plus three translational DOF. Rotations and compound rotations have been
discussed up to this point.

The remaining DOF are translational: Longitude, Latitude, and Altitude. The translational values are
simply the Flight Simulator variables A:PLANE LATITUDE, A:PLANE LONGITUDE, and A:PLANE ALTITUDE.

A typical Google Earth camera orientation would be written as follows:

<Camera>
<longitude>-155.056566267712</longitude>
<latitude>19.7143216472382</latitude>
<altitude>1124.20057499758</altitude>
<heading>10.5365345501778</heading>
<tilt>100.656068754235</tilt>
<roll>4.53358066926012</roll>
<altitudeMode>absolute</altitudeMode>
</Camera>

where heading, tilt, and roll are the compound rotation Euler angles previously discussed.

The Google Earth kml schema assumes ‘degrees’ units for longitude, latitude, heading, tilt and roll and
‘meters’ units for altitude.

Absolute altitude mode means that the altitude value is measured relative to mean sea level, which is the
same reference datum used by A:PLANE ALTITUDE.

Technical Note: atan2 Argument Order

Equations in this paper were evaluated using Microsoft Excel. Spreadsheets such as Excel reverse the
order of arguments in the atan2 function compared to JavaScript. The conventional order, atan2(x, y) is
written as atan2(y, x) in Excel and in this paper.

Consequently, to use the atan2 expressions found here in JavaScript and potentially other languages,
please reverse the order of the arguments.

8
Quaternion Rotation Example
Compound Rotation

AIRCRAFT ATTITUDE CAMERA SWIVEL

Degrees Radians Degrees Radians


Bank u = 60° 1.04720 Roll u = 0° 0.00000
Pitch v = -15° -0.26180 Tilt v = 20° 0.34907
Hdg w = 330° 5.75959 Yaw w = -35° -0.61087

Hdg Pitch Bank Yaw Tilt Roll


cos(θ /2): -0.96593 0.99144 0.86603 cos(θ /2): 0.95372 0.98481 1.00000
sin(θ /2): 0.25882 -0.13053 0.50000 sin(θ /2): -0.30071 0.17365 0.00000

Quaternion Quaternion
r0 -0.84625 s0 0.93923
r1 0.15919 s1 -0.29614
r2 0.23749 s2 0.16561
r3 -0.44957 s3 0.05222

QUATERNION MULTIPLICATION
t=r*s
t0 -0.76354
t1 0.31326
t2 -0.04192
t3 -0.56313

EULER (TAIT-BRYAN) ANGLES FOR GOOGLE EARTH


GE Tilt 90°
Radians Degrees Degrees Eqn.
ROLL 1.16090 66.51° (4)
TILT -0.42995 -24.63° 65.37° (3), (6)
HDG -0.49422 -28.32° (5)

9
Euler (Tait-Bryan) Rotation Example
Compound Rotation

AIRCRAFT ATTITUDE CAMERA SWIVEL

Degrees Radians Degrees Radians


Bank u = 60° 1.04720 Roll u = 0° 0.00000
Pitch v = -15° -0.26180 Tilt v = 20° 0.34907
Hdg w = 330° 5.75959 Yaw w = -35° -0.61087

1 0 0 1 0 0
R x (u) = 0 0.50000 -0.86603 R x (u) = 0 1.00000 0.00000
0 0.86603 0.50000 0 0.00000 1.00000

0.96593 0 -0.25882 0.93969 0 0.34202


R y (v) = 0 1 0 R y (v) = 0 1 0
0.25882 0 0.96593 -0.34202 0 0.93969

0.86603 0.50000 0 0.81915 0.57358 0


R z (w) = -0.50000 0.86603 0 R z (w) = -0.57358 0.81915 0
0 0 1 0 0 1

R FS = R z (Hdg) * R y (Pitch) * R x (Bank) R CAM = R z (Yaw) * R y (Tilt) * R x (Roll)


0.83652 0.05589 -0.54508 0.76975 0.57358 0.28017
-0.48296 0.54508 -0.68530 -0.53899 0.81915 -0.19617
0.25882 0.83652 0.48296 -0.34202 0.00000 0.93969

ROTATION MATRIX MULTIPLICATION


R FS ×CAM = R FS * R CAM
0.80022 0.52558 -0.28881
-0.43117 0.16949 -0.88621
-0.41683 0.83369 0.36225

EULER (TAIT-BRYAN) ANGLES FOR GOOGLE EARTH

GE Tilt 90°
Radians Degrees Degrees Eqn.
ROLL 1.16090 66.51° (12)
TILT -0.42995 -24.63° 65.37° (11), (14)
HDG -0.49422 -28.32° (13)

10
Excel Formulas: QUATERNION
A B C D E F G H
1 AIRCRAFT ATTITUDE CAMERA SWIVEL
2
3 Degrees Radians Degrees Radians
4 Bank u = 60° =RADIANS(C4) Roll u = 0° =RADIANS(G4)
5 Pitch v = -15° =RADIANS(C5) Tilt v = 20° =RADIANS(G5)
6 Hdg w = 330° =RADIANS(C6) Yaw w = -35° =RADIANS(G6)
7
8 Hdg Pitch Bank Yaw Tilt Roll
9 cos(τ /2): =COS(D6/2) =COS(D5/2) =COS(D4/2) =COS(H6/2) =COS(H5/2) =COS(H4/2)
10 sin(τ /2): =SIN(D6/2) =SIN(D5/2) =SIN(D4/2) =SIN(H6/2) =SIN(H5/2) =SIN(H4/2)
11
12 Quaternion Quaternion
13 r0 =B9*C9*D9+B10*C10*D10 s0 =F9*G9*H9+F10*G10*H10
14 r1 =B10*C9*D9-B9*C10*D10 s1 =F10*G9*H9-F9*G10*H10
15 r2 =B9*C10*D9+B10*C9*D10 s2 =F9*G10*H9+F10*G9*H10
16 r3 =B9*C9*D10-B10*C10*D9 s3 =F9*G9*H10-F10*G10*H9

17

18 QUATERNION MULTIPLICATION
19 t=r*s
20 t 0 =C13*G13-C14*G14-C15*G15-C16*G16
21 t 1 =C13*G14+C14*G13-C15*G16+C16*G15
22 t 2 =C13*G15+C14*G16+C15*G13-C16*G14
23 t 3 =C13*G16-C14*G15+C15*G14+C16*G13
24
25 EULER (TAIT-BRYAN) ANGLES FOR GOOGLE EARTH
26
27 GE Tilt 90°
28 Radians Degrees Degrees Eqn.
29 ROLL =ATAN2(E20^2+E21^2-E22^2-E23^2,2*(E20*E23+E21*E22))
30 TILT =-(ASIN(2*(E20*E22-E21*E23)))
31 HDG =(ATAN2(E20^2-E21^2-E22^2+E23^2, 2*(E20*E21+E22*E23)))

Excel Formulas: EULER


A B C D E F G H
1 AIRCRAFT ATTITUDE CAMERA SWIVEL
2
3 Degrees Radians Degrees Radians
4 Bank u = 60° =RADIANS(C4) Roll u = 0° =RADIANS(G4)
5 Pitch v = -15° =RADIANS(C5) Tilt v = 20° =RADIANS(G5)
6 Hdg w = 330° =RADIANS(C6) Yaw w = -35° =RADIANS(G6)
7
8 1 0 0 1 0 0
9 R x (u) = 0 =COS(D4) =-SIN(D4) R x (u) = 0 =COS(H4) =-SIN(H4)
10 0 =SIN(D4) =COS(D4) 0 =SIN(H4) =COS(H4)
11
12 =COS(D5) 0 =SIN(D5) =COS(H5) 0 =SIN(H5)
13 R y (v) = 0 1 0 R y (v) = 0 1 0
14 =-SIN(D5) 0 =COS(D5) =-SIN(H5) 0 =COS(H5)
15
16 =COS(D6) =-SIN(D6) 0 =COS(H6) =-SIN(H6) 0
17 R z (w) = =SIN(D6) =COS(D6) 0 R z (w) = =SIN(H6) =COS(H6) 0
18 0 0 1 0 0 1
19
20 R FS = R z (Hdg) * R y (Pitch) * R x (Bank) R CAM = R z (Yaw) * R y (Tilt) * R x (Roll)
21
22 =MMULT(B16:D18,MMULT(B12:D14,B8:D10)) =MMULT (F16:H18,MMULT(F 12:H14,F8:H10))
23

24

25 ROTATION MATRIX MULTIPLICATION


26 R FS ×CAM = R FS * R CAM
27
28 =MMULT(B16:D18,MMULT(B12:D14,MMULT(B8:D10,MMULT(F16:H18,MMULT(F12:H14,F 8:H10)))))
29
30
31 EULER (TAIT-BRYAN) ANGLES FOR GOOGLE EARTH
32
33 GE Tilt 90°
34 Radians Degrees Degrees Eqn.
35 ROLL =ATAN2(F29/COS(D36),E29/COS(D36))
36 TILT =ASIN(D29)
37 HDG =ATAN2(D27/COS(D36),D28/COS(D36))

11
References:

There are scores of articles and forum threads related to 3D rotation on the web, but for the Flight
Simulator – Google Earth application, the most succinct and relevant that I found are listed below.

Rose, David
http://danceswithcode.net/engineeringnotes/index.html

Slabaugh, Gregory
http://staff.city.ac.uk/~sbbh653/publications/euler.pdf

CH Robotics, Inc.
http://www.chrobotics.com/library

Baker, Martin
http://www.euclideanspace.com/maths/algebra/realNormedAlgebra/quaternions/index.htm

McLellan, James
http://www.mclellansys.com/article_2.htm

and several Wikipedia entries such as


https://en.wikipedia.org/wiki/Euler_angles

12

You might also like