The Relationship Between Unit Vector Rotations and Euler Angle Functions

The Relationship Between Unit Vector Rotations and Euler Angle Functions

<p> 1 The Relationship between Unit Vector Rotations and Euler Angle Functions</p><p>Jed Margolin</p><p>In my article Unit Vector Math for 3D Graphics I show a geometric model where there is a Universe filled with Objects, each of which is free to rotate and translate. Each Object may look at the Universe or any other Object, and each Object will always rotate around its own axes regardless of its (or the Observer's) orientation.</p><p>In the field of aerodynamic modeling (and in computer graphics in general) the method used to do this is to generate functions of Euler Angles. What this means is, "How do I rotate an Object in my frame of reference so that it will appear to rotate in its frame of reference?"</p><p>These functions are:</p><p> dxa = TAN(ya) COS(xa) dsza + TAN(ya) SIN(xa) dsya + dsxa</p><p> dya = -SIN(xa) dsza + COS(xa) dsya</p><p> dza = COS(xa) dsza + SIN(xa) dsya ------COS(ya)</p><p> where: za = Euler angle, rotation around z axis (in World coordinates) dza = incremental rotation around z axis (in World coordinates)</p><p> ya = Euler angle, rotation around y axis (in World coordinates) dya = incremental rotation around y axis (in World coordinates)</p><p> xa = Euler angle, rotation around x axis (in World coordinates) dxa = incremental rotation around x axis (in World coordinates)</p><p> dsza = incremental rotation angle around z axis in Ship coordinates (Yaw)</p><p> dsya = incremental rotation angle around y axis in Ship coordinates (Pitch)</p><p> dsxa = incremental rotation angle around x axis in Ship coordinates (Roll)</p><p>After applying an incremental rotation you need to update za, ya, and xa so that: za' = za + dza ya' = ya + dya xa' = xa + dxa 2</p><p>Euler angle rotations suffer from a number of problems, one of which is that when the object is pointing directly along one of the axes, the equation blows up. In this case, it blows up when ya=90 degrees. (If it's any comfort, you get to choose which axis blows up.)</p><p>In this article I will show the relationship between Unit Vector Math and Euler Angle Functions by finding the functions to relate incremental rotations around the Ship axes to rotations around the World axes (the Euler angles). xa' = xa + dxa where dxa = F1(xa,ya,za,dsxa,dsya,dsza) ya' = ya + dya where dya = F2(xa,ya,za,dsxa,dsya,dsza) za' = za + dza where dza = F3(xa,ya,za,dsxa,dsya,dsza)</p><p>As before, the definitions are:</p><p> za = Euler angle, rotation around z axis (in World coordinates) dza = incremental rotation around z axis (in World coordinates)</p><p> ya = Euler angle, rotation around y axis (in World coordinates) dya = incremental rotation around y axis (in World coordinates)</p><p> xa = Euler angle, rotation around x axis (in World coordinates) dxa = incremental rotation around x axis (in World coordinates)</p><p> dsza = incremental rotation angle around z axis in Ship coordinates (Yaw)</p><p> dsya = incremental rotation angle around y axis in Ship coordinates (Pitch)</p><p> dsxa = incremental rotation angle around x axis in Ship coordinates (Roll)</p><p>We are looking for the functions to relate incremental rotations around the Ship axes to rotations around the World axes (the Euler angles). xa' = xa + dxa where dxa = F1(xa,ya,za,dsxa,dsya,dsza) ya' = ya + dya where dya = F2(xa,ya,za,dsxa,dsya,dsza) za' = za + dza where dza = F3(xa,ya,za,dsxa,dsya,dsza) 3</p><p>It will probably be easier if we separate dsxa, dsya, dsza so that:</p><p>For dsxa there are three functions:</p><p> xa' = xa + G1(xa,ya,za,dsxa) ya' = ya + G2(xa,ya,za,dsxa) za' = za + G3(xa,ya,za,dsxa)</p><p>For dsya there are three functions:</p><p> xa' = xa + G4(xa,ya,za,dsya) ya' = ya + G5(xa,ya,za,dsya) za' = za + G6(xa,ya,za,dsya)</p><p>For dsza there are three functions:</p><p> xa' = xa + G7(xa,ya,za,dsza) ya' = ya + G8(xa,ya,za,dsza) za' = za + G9(xa,ya,za,dsza)</p><p>If we can find the separate functions we can combine them later.</p><p>Rotations:</p><p>Yaw X' = X COS(za) - Y SIN(za) [Equation 1] Y' = X SIN(za) + Y COS(za)</p><p>Pitch Z' = Z COS(ya) - X SIN(ya) [Equation 2] X' = Z SIN(ya) + X COS(ya)</p><p>Roll Y' = Y COS(xa) - Z SIN(xa) [Equation 3] Z' = Y SIN(xa) + Z COS(xa) 4</p><p>Consolidating Equations 1, 2, and 3 for a motion consisting of rotations za, ya, xa (Yaw, Pitch, Roll in that order) yields: </p><p>X" = [ COS(ya) COS(za) ] X + [-COS(ya) SIN(za)] Y + [SIN(ya)] Z</p><p>Y" = [ SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za)] X + [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] Y + [-SIN(xa) COS(ya)] Z</p><p>Z" = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] X + [ COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] Y + [COS()xa COS(ya)] Z</p><p>The Matrix Form is: Ax Ay Az Bx By Bz Cx Cy Cz</p><p>Where:</p><p>Ax = COS(ya) COS(za)</p><p>Ay = -COS(ya) SIN(za)</p><p>Az = SIN(ya)</p><p>Bx = SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) </p><p>By = -SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za) </p><p>Bz = -SIN(xa) COS(ya)</p><p>Cx = -COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za) </p><p>Cy = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)</p><p>Cz = COS(xa) COS(ya) xa, ya, za are called the Euler Angles. 5 Ship Yaw</p><p>We want to find out how the Euler angles are changed if we yaw the Ship in its coordinate system.</p><p>1.1 Start with Euler equations:</p><p>Ax = COS(ya) COS(za) Ay = -COS(ya) SIN(za) Az = SIN(ya)</p><p>Bx = SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) By = -SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za) Bz = -SIN(xa) COS(ya)</p><p>Cx = -COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za) Cy = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za) Cz = COS(xa) COS(ya)</p><p>1.2 Transform it to the Ship Frame of Reference</p><p>Ax = COS(ya) COS(za) Bx = -COS(ya) SIN(za) Cx = SIN(ya)</p><p>Ay = SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) By = -SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za) Cy = -SIN(xa) COS(ya)</p><p>Az = -COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za) Bz = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za) Cz = COS(xa) COS(ya) 6</p><p>1.3 Yaw Ship by angle dsza</p><p>Ax' = Ax COS(dsza) - Ay SIN(dsza) Ay' = Ax SIN(dsza) + Ay COS(dsza) Az' = Az </p><p>Bx' = Bx COS(dsza) - By SIN(dsza) By' = Bx SIN(dsza) + By COS(dsza) Bz' = Bz </p><p>Cx' = Cx COS(dsza) - Cy SIN(dsza) Cy' = Cx SIN(dsza) + Cy COS(dsza) Cz' = Cz </p><p>Therefore:</p><p>Ax' = [ COS(ya) COS(za)] COS(dsza) - [SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za)] SIN(dsza)</p><p>Ay' = [ COS(ya) COS(za)] SIN(dsza) + [SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za)] COS(dsza)</p><p>Az' = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] </p><p>Bx' = [-COS(ya) SIN(za)] COS(dsza) - [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] SIN(dsza)</p><p>By' = [-COS(ya) SIN(za)] SIN(dsza) + [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] COS(dsza)</p><p>Bz' = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)</p><p>Cx' = [ SIN(ya)] COS(dsza) - [-SIN(xa) COS(ya)] SIN(dsza)</p><p>Cy' = [SIN(ya)] SIN(dsza) + [-SIN(xa) COS(ya)] COS(dsza)</p><p>Cz' = COS(xa) COS(ya) 7</p><p>1.4 Transform it back to Universe Coordinates:</p><p>Ax' = [ COS(ya) COS(za) ] COS(dsza) - [ SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) ] SIN(dsza)</p><p>Bx' = [ COS(ya) COS(za) ] SIN(dsza) + [ SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) ] COS(dsza)</p><p>Cx' = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] </p><p>Ay' = [-COS(ya) SIN(za)] COS(dsza) - [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] SIN(dsza)</p><p>By' = [-COS(ya) SIN(za)] SIN(dsza) + [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] COS(dsza)</p><p>Cy' = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)</p><p>Az' = [SIN(ya)] COS(dsza) - [-SIN(xa) COS(ya)] SIN(dsza)</p><p>Bz' = [SIN(ya)] SIN(dsza) + [-SIN(xa) COS(ya)] COS(dsza)</p><p>Cz' = COS(xa) COS(ya) 8</p><p>1.5 We are looking for the dza, dya, dxa that give this same result.</p><p>Find dya as a function of dsza:</p><p>Az = SIN(ya) [From Section 1.1] </p><p>Az' = SIN(ya+dya)</p><p>= SIN(ya) COS(dya) + COS(ya) SIN(dya) [Trigonometric Expansion] </p><p>This must be equal to the Az' obtained by Yawing the Ship. </p><p>Az' = [SIN(ya)] COS(dsza) - [-SIN(xa) COS(ya)] SIN(dsza) [From Section 1.4]</p><p>Therefore</p><p>SIN(ya) COS(dya) + COS(ya) SIN(dya) = [SIN(ya)] COS(dsza) - [-SIN(xa) COS(ya)] SIN(dsza) </p><p>Assuming dya and dsza are small: COS(dya)=1, SIN(dya)=dya, COS(dsza)=1, SIN(dsza)=dsza</p><p>SIN(ya) + COS(ya)(dya) = SIN(ya) - [-SIN(xa)COS(ya)](dsza) so that:</p><p>COS(ya)(dya) = SIN(xa) COS(ya) (dsza) </p><p>(dya) = SIN(xa) COS(ya) (dsza) ------COS(ya)</p><p>The result is that:</p><p> dya = dsza SIN(xa) [Equation 4] 9</p><p>Find dza as a function of dsza:</p><p>Ax = COS(ya) COS(za) [from Section 1.1]</p><p>Ax' = COS(ya+dya) COS(za+dza)</p><p>= [COS(ya)COS(dya) - SIN(ya)SIN(dya)] * [COS(za)COS(dza)- SIN(za)SIN(dza)] [Trigonometric expansion] </p><p>Assuming dya, dza are small:</p><p>Ax' = [COS(ya)- SIN(ya)(dya) ] [COS(za)- SIN(za)(dza)]</p><p>= COS(ya)COS(za)- SIN(ya)(dya)COS(za)- SIN(za)(dza)COS(ya) + SIN(ya)(dya)SIN(za)(dza)</p><p>Since dya, dza are small the last term {SIN(ya) (dya) SIN(za) (dza)} is approximately zero, so that:</p><p>Ax' = COS(ya)COS(za)- SIN(ya)COS(za)dya - SIN(za)COS(ya)dza </p><p>This must be equal to the Ax' obtained by Yawing the Ship.</p><p>Ax' = COS(ya)COS(za)COS(dsza) - [SIN(xa)SIN(ya)COS(za)+ COS(xa)SIN(za)] SIN(dsza) [from Section 1.4]</p><p>= COS(ya)COS(za)COS(dsza) - SIN(xa) SIN(ya) COS(za) SIN(dsza) + COS(xa) SIN(za) SIN(dsza)</p><p>Assuming dya, dza are small:</p><p>Ax' = COS(ya)COS(za) - SIN(xa)SIN(ya)COS(za)dsza + COS(xa)SIN(za)(dsza)</p><p>Therefore:</p><p>COS(ya)COS(za) - SIN(ya)COS(za)dya - SIN(za)COS(ya)dza = COS(ya)COS(za) - SIN(xa) SIN(ya) COS(za) dsza + 10 COS(xa) SIN(za) dsza </p><p>Cranking through it:</p><p>SIN(ya) COS(za) dya - SIN(za) COS(ya) dza = </p><p>-SIN(xa) SIN(ya) COS(za) dsza + COS(xa) SIN(za) dsza</p><p>From Equation 4, dya = dsza SIN(xa) </p><p>Therefore</p><p>-SIN(ya) dsza SIN(xa) COS(za) - SIN(za)COS(ya) dza = -SIN(xa) SIN(ya) COS(za) dsza + COS(xa) SIN(za) dsza</p><p>-SIN(za) COS(ya) dza = -SIN(xa) SIN(ya)COS(za) dsza + COS(xa) SIN(za) dsza - SIN(ya) dsza SIN(xa) COS(za) </p><p>= -SIN(xa) SIN(ya)COS(za) dsza + SIN(ya) dsza SIN(xa) COS(za) + COS(xa) SIN(za) dsza </p><p>= -SIN(xa) SIN(ya)COS(za) dsza + SIN(ya) SIN(xa) COS(za) dsza + COS(xa) SIN(za) dsza </p><p>= COS(xa) SIN(za) dsza </p><p> dza = -COS(xa) SIN(za) dsza ------SIN(za) COS(ya)</p><p>The result is that:</p><p> dza = -COS(xa) dsza ------[Equation 5] COS(ya) 11 Find dxa as a function of dsza:</p><p>Cz = COS(xa) COS(ya) [from Section 1.1]</p><p>Cz' = COS(xa+dxa) COS(ya+dya)</p><p>= [ COS(xa) COS(dxa) - SIN(xa) SIN(dxa) ] * [ COS(ya) COS(dya) - SIN(ya) SIN(dya) ] [Trigonometric Expansion]</p><p>Assuming dxa, dya are small:</p><p>Cz' = [ COS(xa) - SIN(xa) dxa ] [ COS(ya) - SIN(ya) dya ] </p><p>= COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya + SIN(xa) dxa SIN(ya) dya</p><p>Since dxa, dya are small the last term {SIN(xa) dxa SIN(ya) dya} is approximately zero.</p><p>Cz' = COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya </p><p>This must be equal to the Cz' obtained by Yawing the Ship.</p><p>Cz' = COS(xa) COS(ya) [From Section 1.4]</p><p>Therefore:</p><p>COS(xa) COS(ya) = COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya </p><p>Cranking through it: 0 = - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya </p><p>From Equation 4, dya = dsza SIN(xa) 0 = - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dsza SIN(xa) </p><p>COS(ya) SIN(xa) dxa = - COS(xa) SIN(ya) dsza SIN(xa) </p><p> dxa = - COS(xa) SIN(ya) dsza SIN(xa) ------COS(ya) SIN(xa)</p><p>The result is that:</p><p> dxa = - COS(xa) TAN(ya) dsza [Equation 6] 12</p><p>Ship Pitch </p><p>We want to find out how the Euler angles are changed if we pitch the Ship in its coordinate system.</p><p>2.1 Start with Euler equations:</p><p>Ax = COS(ya) COS(za) Ay = -COS(ya) SIN(za) Az = SIN(ya)</p><p>Bx = SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) By = -SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za) Bz = -SIN(xa) COS(ya)</p><p>Cx = -COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za) Cy = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za) Cz = COS(xa) COS(ya)</p><p>2.2 Transform it to the Ship Frame of Reference</p><p>Ax = COS(ya) COS(za) Bx = -COS(ya) SIN(za) Cx = SIN(ya)</p><p>Ay = SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) By = -SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za) Cy = -SIN(xa) COS(ya)</p><p>Az = -COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za) Bz = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za) Cz = COS(xa) COS(ya) 13</p><p>2.3 Pitch Ship by angle dsya</p><p>Az' = Az COS(dsya) - Ax SIN(dsya) Ax' = Az SIN(dsya) + Ax COS(dsya) Ay' = Ay</p><p>Bz' = Bz COS(dsya) - Bx SIN(dsya) Bx' = Bz SIN(dsya) + Bx SIN(dsya) By' = By</p><p>Cz' = Cz COS(dsya) - Cx SIN(dsya) Cx' = Cz SIN(dsya) + Cx COS(dsya) Cy' = Cy</p><p>Therefore:</p><p>Az' = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] COS(dsya) - [COS(ya) COS(za)] SIN(dsya)</p><p>Ax' = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] SIN(dsya) + [COS(ya) COS(za)] COS(dsya)</p><p>Ay' = [SIN(xa) SIN(ya) COS(za)+COS(xa) SIN(za)]</p><p>Bz' = [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] COS(dsya) - [-COS(ya) SIN(za)] SIN(dsya)</p><p>Bx' = [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] SIN(dsya) + [-COS(ya) SIN(za)] SIN(dsya)</p><p>By' = [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)]</p><p>Cz' = [COS(xa) COS(ya)] COS(dsya) - [SIN(ya)] SIN(dsya)</p><p>Cx' = [COS(xa) COS(ya)] SIN(dsya) + [SIN(ya)] COS(dsya)</p><p>Cy' = [-SIN(xa) COS(ya)] 14</p><p>2.4 Transform it back to Universe Coordinates:</p><p>Ax' = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] SIN(dsya) + [COS(ya) COS(za)] COS(dsya)</p><p>Bx' = [SIN(xa) SIN(ya) COS(za)+COS(xa) SIN(za)]</p><p>Cx' = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] COS(dsya) - [COS(ya) COS(za)] SIN(dsya)</p><p>Ay' = [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] SIN(dsya) + [-COS(ya) SIN(za)] SIN(dsya)</p><p>By' = [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)]</p><p>Cy' = [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] COS(dsya) - [-COS(ya) SIN(za)] SIN(dsya)</p><p>Az' = [COS(xa) COS(ya)] SIN(dsya) + [SIN(ya)] COS(dsya)</p><p>Bz' = [-SIN(xa) COS(ya)]</p><p>Cz' = [COS(xa) COS(ya)] COS(dsya) - [SIN(ya)] SIN(dsya) 15</p><p>2.5 We are looking for the dza, dya, dxa that give this same result.</p><p>Find dya as a function of dsya:</p><p>Az = SIN(ya) [From Section 2.1] </p><p>Az' = SIN(ya+dya)</p><p>= SIN(ya) COS(dya) + COS(ya) SIN(dya) [Trigonometric Expansion] </p><p>This must be equal to the Az' obtained by Pitching the Ship.</p><p>Az' = [COS(xa) COS(ya)] SIN(dsya) + [SIN(ya)] COS(dsya) [From Section 2.4]</p><p>Therefore</p><p>SIN(ya) COS(dya) + COS(ya) SIN(dya) = [COS(xa) COS(ya)] SIN(dsya) + [SIN(ya)] COS(dsya)</p><p>Assuming dya and dsya are small: COS(dya) = 1, SIN(dya) = dya, COS(dsya) = 1, SIN(dsya) = dsya</p><p>SIN(ya) + COS(ya) dya = COS(xa) COS(ya) dsya + SIN(ya)</p><p>Cranking through it:</p><p>COS(ya) dya = COS(xa) COS(ya) dsya + SIN(ya) - SIN(ya) </p><p>= COS(xa) COS(ya) dsya </p><p> dya = COS(xa) COS(ya) dsya ------COS(ya) </p><p>The result is that: dya = COS(xa) dsya [Equation 7] 16 Find dza as a function of dsya:</p><p>Ax = COS(ya) COS(za) [from Section 2.1]</p><p>Ax' = COS(ya+dya) COS(za+dza)</p><p>= [ COS(ya) COS(dya) - SIN(ya) SIN(dya) ] * [ COS(za) COS(dza) - SIN(za) SIN(dza) ] [Trigonometric expansion]</p><p>Assuming dya, dza are small:</p><p>Ax' = [ COS(ya) - SIN(ya) (dya) ] [ COS(za) - SIN(za) (dza) ]</p><p>= COS(ya) COS(za) - SIN(ya) (dya) COS(za) - SIN(za) (dza) COS(ya) + SIN(ya) (dya) SIN(za) (dza)</p><p>Since dya, dza are small the last term {SIN(ya) (dya) SIN(za) (dza)} is approximately zero.</p><p>Ax' = COS(ya) COS(za) - SIN(ya) COS(za) dya - SIN(za) COS(ya) dza </p><p>This must be equal to the Ax' obtained by Pitching the Ship.</p><p>Ax' = [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] SIN(dsya) + COS(ya) COS(za) COS(dsya) [From Section 2.4]</p><p>= -COS(xa) SIN(ya) COS(za) SIN(dsya) + SIN(xa) SIN(za) SIN(dsya) + COS(ya) COS(za) COS(dsya)</p><p>Assuming dsya, dsza small:</p><p>Ax' = -COS(xa) SIN(ya) COS(za) dsya + SIN(xa) SIN(za) dsya + COS(ya) COS(za) </p><p>Therefore:</p><p>COS(ya) COS(za) - SIN(ya) COS(za) dya - SIN(za) COS(ya) dza = -COS(xa) SIN(ya) COS(za) dsya + SIN(xa) SIN(za) dsya + COS(ya) COS(za)</p><p>Cranking through it:</p><p>- SIN(ya) COS(za) dya - SIN(za) COS(ya) dza = -COS(xa) SIN(ya) COS(za) dsya + SIN(xa) SIN(za) dsya 17</p><p>From Equation 7, dya = COS(xa) dsya </p><p>- SIN(ya) COS(za) COS(xa) dsya - SIN(za) COS(ya) dza = -COS(xa) SIN(ya) COS(za) dsya + SIN(xa) SIN(za) dsya </p><p>- SIN(za) COS(ya) dza = -COS(xa) SIN(ya) COS(za) dsya + SIN(xa) SIN(za) dsya + SIN(ya) COS(za) COS(xa) dsya</p><p>- SIN(za) COS(ya) dza = -COS(xa) SIN(ya) COS(za) dsya + SIN(xa) SIN(za) dsya + COS(xa) SIN(ya) COS(za) dsya</p><p>- SIN(za) COS(ya) dza = SIN(xa) SIN(za) dsya </p><p> dza = SIN(xa) SIN(za) dsya ------SIN(za) COS(ya)</p><p>The result is that:</p><p> dza = - SIN(xa) dsya ------[Equation 8] COS(ya) 18 Find dxa as a function of dsya: </p><p>Cz = COS(xa) COS(ya) [from Section 2.1]</p><p>Cz' = COS(xa+dxa) COS(ya+dya)</p><p>= [ COS(xa) COS(dxa) - SIN(xa) SIN(dxa) ] * [ COS(ya) COS(dya) - SIN(ya) SIN(dya) ] [Trigonometric Expansion]</p><p>Assuming dxa, dya are small:</p><p>Cz' = [ COS(xa) - SIN(xa) dxa ] [ COS(ya) - SIN(ya) dya ] </p><p>= COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya + SIN(xa) dxa SIN(ya) dya</p><p>Since dxa, dya are small the last term {SIN(xa) dxa SIN(ya) dya} is approximately zero.</p><p>Cz' = COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya </p><p>This must be equal to the Cz' obtained by Pitching the Ship.</p><p>Cz' = [COS(xa) COS(ya)] COS(dsya) - [SIN(ya)] SIN(dsya) [From Section 2.4]</p><p>For small dsya:</p><p>Cz' = COS(xa) COS(ya) - SIN(ya) dsya</p><p>Therefore:</p><p>COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya = COS(xa) COS(ya) - SIN(ya) dsya 19</p><p>Cranking through it:</p><p>- COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya = - SIN(ya) dsya</p><p>From Equation 7, dya = COS(xa) dsya , so that:</p><p>- COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) COS(xa) dsya = - SIN(ya) dsya</p><p>- COS(ya) SIN(xa) dxa = - SIN(ya) dsya + COS(xa) SIN(ya) COS(xa) dsya</p><p>= SIN(ya) dsya [ COS(xa) COS(xa) - 1]</p><p> dxa = SIN(ya) dsya [ COS(xa) COS(xa) - 1 ] ------COS(ya) SIN(xa)</p><p>Since SIN**2 + COS**2 = 1, [ COS(xa) COS(xa) -1 ] = [ -SIN(xa) SIN(xa) ]</p><p> dxa = SIN(ya) dsya [ -SIN(xa) SIN(xa) ] ------COS(ya) SIN(xa)</p><p>= SIN(ya) dsya [ -SIN(xa) ] ------COS(ya)</p><p>The result is that:</p><p> dxa = TAN(ya) SIN(xa) dsya [Equation 9] 20 Ship Roll </p><p>We want to find out how the Euler angles are changed if we Roll the Ship in its coordinate system.</p><p>3.1 Start with Euler equations:</p><p>Ax = COS(ya) COS(za) Ay = -COS(ya) SIN(za) Az = SIN(ya)</p><p>Bx = SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) By = -SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za) Bz = -SIN(xa) COS(ya)</p><p>Cx = -COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za) Cy = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za) Cz = COS(xa) COS(ya)</p><p>3.2 Transform it to the Ship Frame of Reference</p><p>Ax = COS(ya) COS(za) Bx = -COS(ya) SIN(za) Cx = SIN(ya)</p><p>Ay = SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za) By = -SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za) Cy = -SIN(xa) COS(ya)</p><p>Az = -COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za) Bz = COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za) Cz = COS(xa) COS(ya) 21</p><p>3.3 Roll Ship by angle dsxa</p><p>Ay' = Ay COS(dsxa) - Az SIN(dsxa) Az' = Ay SIN(dsxa) + Az COS(dsxa)</p><p>By' = By COS(dsxa) - Bz SIN(dsxa) Bz' = By SIN(dsxa) + Bz COS(dsxa)</p><p>Cy' = Cy COS(dsxa) - Cz SIN(dsxa) Cz' = Cy SIN(dsxa) + Cz COS(dsxa)</p><p>Therefore:</p><p>Ax' = [COS(ya) COS(za)]</p><p>Ay' = [SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za)] COS(dsxa) - [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] SIN(dsxa)</p><p>Az' = [SIN(xa) SIN(ya) COS(za) + COS(xa) SIN(za)] SIN(dsxa) + [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] COS(dsxa)</p><p>Bx' = [-COS(ya) SIN(za)]</p><p>By' = [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] COS(dsxa) - [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] SIN(dsxa)</p><p>Bz' = [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] SIN(dsxa) + [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] COS(dsxa)</p><p>Cx' = [SIN(ya)]</p><p>Cy' = [-SIN(xa) COS(ya)] COS(dsxa) - [COS(xa) COS(ya)] SIN(dsxa)</p><p>Cz' = [-SIN(xa) COS(ya)] SIN(dsxa) + [COS(xa) COS(ya)] COS(dsxa) 22</p><p>3.4 Transform it back to Universe Coordinates:</p><p>Ax' = [COS(ya) COS(za)]</p><p>Bx' = [SIN(xa) SIN(ya) COS(za)+COS(xa) SIN(za)] COS(dsxa) - [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] SIN(dsxa)</p><p>Cx' = [SIN(xa) SIN(ya) COS(za)+COS(xa) SIN(za)] SIN(dsxa) + [-COS(xa) SIN(ya) COS(za) + SIN(xa) SIN(za)] COS(dsxa)</p><p>Ay' = [-COS(ya) SIN(za)]</p><p>By' = [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] COS(dsxa) - [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] SIN(dsxa)</p><p>Cy' = [-SIN(xa) SIN(ya) SIN(za) + COS(xa) COS(za)] SIN(dsxa) + [COS(xa) SIN(ya) SIN(za) + SIN(xa) COS(za)] COS(dsxa)</p><p>Az' = [SIN(ya)]</p><p>Bz' = [-SIN(xa) COS(ya)] COS(dsxa) - [COS(xa) COS(ya)] SIN(dsxa)</p><p>Cz' = [-SIN(xa) COS(ya)] SIN(dsxa) + [COS(xa) COS(ya)] COS(dsxa)</p><p>3.5 We are looking for the dza, dya, dxa that give this same result. 23 Find dya as a function of dsxa:</p><p>Az = SIN(ya) [From Section 3.1] </p><p>Az' = SIN(ya+dya)</p><p>= SIN(ya) COS(dya) + COS(ya) SIN(dya) [Trigonometric Expansion] </p><p>This must be equal to the Az' obtained by Rolling the Ship.</p><p>Az' = [SIN(ya)] [From Section 3.4]</p><p>Therefore:</p><p>SIN(ya) COS(dya) + COS(ya) SIN(dya) = [SIN(ya)]</p><p>Assuming dya is small:</p><p>SIN(ya) + COS(ya) dya = SIN(ya)</p><p>COS(ya) dya = SIN(ya) - SIN(ya) </p><p>COS(ya) dya = 0</p><p>The result is that:</p><p> dya = 0 [Equation 10] 24 Find dza as a function of dsxa:</p><p>Ax = COS(ya) COS(za) [from Section 3.1]</p><p>Ax' = COS(ya+dya) COS(za+dza)</p><p>= [ COS(ya) COS(dya) - SIN(ya) SIN(dya) ] * [ COS(za) COS(dza) - SIN(za) SIN(dza) ] [Trigonometric expansion]</p><p>Assuming dya, dza are small:</p><p>Ax' = [ COS(ya) - SIN(ya) (dya) ] [ COS(za) - SIN(za) (dza) ]</p><p>= COS(ya) COS(za) - SIN(ya) (dya) COS(za) - SIN(za) (dza) COS(ya) + SIN(ya) (dya) SIN(za) (dza)</p><p>Since dya, dza are small the last term {SIN(ya) (dya) SIN(za) (dza)} is approximately zero.</p><p>Ax' = COS(ya) COS(za) - SIN(ya) COS(za) dya - SIN(za) COS(ya) dza </p><p>This must be equal to the Ax' obtained by Rolling the Ship.</p><p>Ax' = [COS(ya) COS(za)] [From Section 3.4]</p><p>Therefore:</p><p>COS(ya) COS(za) - SIN(ya) COS(za) dya - SIN(za) COS(ya) dza = COS(ya) COS(za)</p><p>Cranking through it:</p><p>- SIN(ya) COS(za) dya - SIN(za) COS(ya) dza = 0</p><p>From Equation 10, dya = 0</p><p>- SIN(za) COS(ya) dza = 0</p><p>The result is that:</p><p> dza = 0 [Equation 11] 25 Find dxa as a function of dsxa:</p><p>Cz = COS(xa) COS(ya) [from Section 3.1]</p><p>Cz' = COS(xa+dxa) COS(ya+dya)</p><p>= [ COS(xa) COS(dxa) - SIN(xa) SIN(dxa) ] * [ COS(ya) COS(dya) - SIN(ya) SIN(dya) ] [Trigonometric Expansion]</p><p>Assuming dxa, dya are small:</p><p>Cz' = [ COS(xa) - SIN(xa) dxa ] [ COS(ya) - SIN(ya) dya ] </p><p>= COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya + SIN(xa) dxa SIN(ya) dya</p><p>Since dxa, dya are small the last term {SIN(xa) dxa SIN(ya) dya} is approximately zero.</p><p>Cz' = COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya </p><p>This must be equal to the Cz' obtained by Rolling the Ship. From Section 3.4</p><p>Cz' = [-SIN(xa) COS(ya)] SIN(dsxa) + [COS(xa) COS(ya)] COS(dsxa)</p><p>For small dsxa:</p><p>Cz' = -SIN(xa) COS(ya) dsxa + COS(xa) COS(ya)</p><p>Therefore:</p><p>COS(xa) COS(ya) - COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya = -SIN(xa) COS(ya) dsxa + COS(xa) COS(ya)</p><p>Cranking through it:</p><p>- COS(ya) SIN(xa) dxa - COS(xa) SIN(ya) dya = -SIN(xa) COS(ya) dsxa </p><p>From Equation 10, dya = 0</p><p>- COS(ya) SIN(xa) dxa = -SIN(xa) COS(ya) dsxa </p><p>The result is that: dxa = dsxa [Equation 12] 26 Results</p><p>Yaw the Ship by dsza:</p><p> dxa = -TAN(ya) COS(xa) dsza [from Equation 6]</p><p> dya = SIN(xa) dsza [from Equation 4]</p><p> dza = -COS(xa) dsza [from Equation 5] ------COS(ya)</p><p> xa' = xa + dxa</p><p> ya' = ya + dya</p><p> za' = za + dza</p><p>Pitch the Ship by dsya:</p><p> dxa = TAN(ya) SIN(xa) dsya [from Equation 9]</p><p> dya = COS(xa) dsya [from Equation 7]</p><p> dza = SIN(xa) dsya [from Equation 8] ------COS(ya)</p><p> xa' = xa + dxa</p><p> ya' = ya + dya</p><p> za' = za + dza 27</p><p>Roll the Ship by dsxa:</p><p> dxa = dsxa [from Equation 12]</p><p> dya = 0 [from Equation 10]</p><p> dza = 0 [from Equation 11]</p><p> xa' = xa + dxa</p><p> ya' = ya + dya</p><p> za' = za + dza</p><p>The Total comes to:</p><p> dxa = -TAN(ya) COS(xa) dsza + TAN(ya) SIN(xa) dsya + dsxa</p><p> dya = SIN(xa) dsza + COS(xa) dsya</p><p> dza = -COS(xa) dsza + SIN(xa) dsya ------COS(ya)</p><p> xa' = xa + dxa</p><p> ya' = ya + dya</p><p> za' = za + dza</p><p>The standard orientation used in aerodynamic modeling has the x axis straight ahead, the y axis to the right, and the z axis straight down.</p><p>My model also has the x axis straight ahead and the y axis to the right, but has the z axis straight up. 28</p><p>If we replace dsza by -dsza we get:</p><p> dxa = TAN(ya) COS(xa) dsza + TAN(ya) SIN(xa) dsya + dsxa</p><p> dya = -SIN(xa) dsza + COS(xa) dsya</p><p> dza = COS(xa) dsza + SIN(xa) dsya ------COS(ya)</p><p>Advantages of Euler angles:</p><p>The errors that accumulate are angular errors that are in the player loop and should therefore be unnoticeable.</p><p>Disadvantages of Euler angles:</p><p>1. One must be able to calculate trigonometric functions for 0 - 360 degrees divided into the smallest incremental angles used.</p><p>2. The Euler angles for an object pointed straight up or straight down are indeterminate and therefore are special cases that must be handled. </p><p>3. The Tangent function starts getting large above Pitch angles of 60 degrees, requiring floating point arithmetic. Pitch angles in the vicinity of plus or minus 90 degrees may be a problem .</p><p>4. The Euler angle functions are only an approximation, valid for small incremental rotations.</p><p>Advantages of Unit Vectors:</p><p>1. The Trig table is relatively small, consisting only of the number of different incremental angles used.</p><p>2. There are no special cases for any orientation.</p><p>3. All arithmetic can be done with 16 bit integers. 29</p><p>Disadvantages of Unit Vectors:</p><p>1. The errors that accumulate result in a distortion of the Universe. [With the use of Magic Angles and Tics this has not been a problem.]</p><p>2. Some mathematical models are constructed around the use of Euler angle functions.</p><p>Jed Margolin San Jose, CA June 27, 2001</p><p>______</p><p>Copyright 1986, 2001 Jed Margolin</p><p>Send comments through my web site at www.jmargolin.com</p>

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    29 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us