mirror of
https://gitlab.com/libeigen/eigen.git
synced 2026-04-10 11:34:33 +08:00
Clang-format tests, examples, libraries, benchmarks, etc.
This commit is contained in:
committed by
Rasmus Munk Larsen
parent
3252ecc7a4
commit
46e9cdb7fe
@@ -3,8 +3,7 @@
|
||||
|
||||
using namespace Eigen;
|
||||
|
||||
int main()
|
||||
{
|
||||
int main() {
|
||||
// A common Euler system by many armies around the world,
|
||||
// where the first one is the azimuth(the angle from the north -
|
||||
// the same angle that is show in compass)
|
||||
@@ -14,33 +13,32 @@ int main()
|
||||
// Keep remembering we're using radian angles here!
|
||||
typedef EulerSystem<-EULER_Z, EULER_Y, EULER_X> MyArmySystem;
|
||||
typedef EulerAngles<double, MyArmySystem> MyArmyAngles;
|
||||
|
||||
MyArmyAngles vehicleAngles(
|
||||
3.14/*PI*/ / 2, /* heading to east, notice that this angle is counter-clockwise */
|
||||
-0.3, /* going down from a mountain */
|
||||
0.1); /* slightly rolled to the right */
|
||||
|
||||
|
||||
MyArmyAngles vehicleAngles(3.14 /*PI*/ / 2, /* heading to east, notice that this angle is counter-clockwise */
|
||||
-0.3, /* going down from a mountain */
|
||||
0.1); /* slightly rolled to the right */
|
||||
|
||||
// Some Euler angles representation that our plane use.
|
||||
EulerAnglesZYZd planeAngles(0.78474, 0.5271, -0.513794);
|
||||
|
||||
|
||||
MyArmyAngles planeAnglesInMyArmyAngles(planeAngles);
|
||||
|
||||
|
||||
std::cout << "vehicle angles(MyArmy): " << vehicleAngles << std::endl;
|
||||
std::cout << "plane angles(ZYZ): " << planeAngles << std::endl;
|
||||
std::cout << "plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl;
|
||||
|
||||
|
||||
// Now lets rotate the plane a little bit
|
||||
std::cout << "==========================================================\n";
|
||||
std::cout << "rotating plane now!\n";
|
||||
std::cout << "==========================================================\n";
|
||||
|
||||
|
||||
Quaterniond planeRotated = AngleAxisd(-0.342, Vector3d::UnitY()) * planeAngles;
|
||||
|
||||
|
||||
planeAngles = planeRotated;
|
||||
planeAnglesInMyArmyAngles = planeRotated;
|
||||
|
||||
|
||||
std::cout << "new plane angles(ZYZ): " << planeAngles << std::endl;
|
||||
std::cout << "new plane angles(MyArmy): " << planeAnglesInMyArmyAngles << std::endl;
|
||||
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user