EulerAngles.cpp File Reference

Go to the source code of this file.

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )

Definition at line 6 of file EulerAngles.cpp.

7 {
8  // A common Euler system by many armies around the world,
9  // where the first one is the azimuth(the angle from the north -
10  // the same angle that is show in compass)
11  // and the second one is elevation(the angle from the horizon)
12  // and the third one is roll(the angle between the horizontal body
13  // direction and the plane ground surface)
14  // Keep remembering we're using radian angles here!
15  typedef EulerSystem<-EULER_Z, EULER_Y, EULER_X> MyArmySystem;
16  typedef EulerAngles<double, MyArmySystem> MyArmyAngles;
17 
18  MyArmyAngles vehicleAngles(
19  3.14/*PI*/ / 2, /* heading to east, notice that this angle is counter-clockwise */
20  -0.3, /* going down from a mountain */
21  0.1); /* slightly rolled to the right */
22 
23  // Some Euler angles representation that our plane use.
24  EulerAnglesZYZd planeAngles(0.78474, 0.5271, -0.513794);
25 
26  MyArmyAngles planeAnglesInMyArmyAngles(planeAngles);
27 
28  std::cout << "vehicle angles(MyArmy): " << vehicleAngles << std::endl;
29  std::cout << "plane angles(ZYZ): " << planeAngles << std::endl;
30  std::cout << "plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl;
31 
32  // Now lets rotate the plane a little bit
33  std::cout << "==========================================================\n";
34  std::cout << "rotating plane now!\n";
35  std::cout << "==========================================================\n";
36 
37  Quaterniond planeRotated = AngleAxisd(-0.342, Vector3d::UnitY()) * planeAngles;
38 
39  planeAngles = planeRotated;
40  planeAnglesInMyArmyAngles = planeRotated;
41 
42  std::cout << "new plane angles(ZYZ): " << planeAngles << std::endl;
43  std::cout << "new plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl;
44 
45  return 0;
46 }
Represents a rotation in a 3 dimensional space as three Euler angles.
Definition: EulerAngles.h:103
Represents a fixed Euler rotation system.
Definition: EulerSystem.h:129
@ EULER_X
Definition: EulerSystem.h:65
@ EULER_Z
Definition: EulerSystem.h:67
@ EULER_Y
Definition: EulerSystem.h:66
AngleAxis< double > AngleAxisd