diff options
author | James Goppert <james.goppert@gmail.com> | 2013-01-13 19:23:59 -0500 |
---|---|---|
committer | James Goppert <james.goppert@gmail.com> | 2013-01-13 19:23:59 -0500 |
commit | 0ccdbd78f69444c3084b927f3e6fd2fe80549d28 (patch) | |
tree | 051f59bb1d271447737893e7b188dd54220db956 /apps/mathlib | |
parent | e02791ee8e56cbe913751cbb279cb66ab5919202 (diff) | |
download | px4-firmware-0ccdbd78f69444c3084b927f3e6fd2fe80549d28.tar.gz px4-firmware-0ccdbd78f69444c3084b927f3e6fd2fe80549d28.tar.bz2 px4-firmware-0ccdbd78f69444c3084b927f3e6fd2fe80549d28.zip |
More formatting.
Diffstat (limited to 'apps/mathlib')
-rw-r--r-- | apps/mathlib/math/Dcm.cpp | 38 | ||||
-rw-r--r-- | apps/mathlib/math/Dcm.hpp | 4 | ||||
-rw-r--r-- | apps/mathlib/math/EulerAngles.cpp | 6 | ||||
-rw-r--r-- | apps/mathlib/math/Quaternion.cpp | 8 |
4 files changed, 28 insertions, 28 deletions
diff --git a/apps/mathlib/math/Dcm.cpp b/apps/mathlib/math/Dcm.cpp index 25f4913a6..df0f09b20 100644 --- a/apps/mathlib/math/Dcm.cpp +++ b/apps/mathlib/math/Dcm.cpp @@ -53,20 +53,20 @@ Dcm::Dcm() : } Dcm::Dcm(float c00, float c01, float c02, - float c10, float c11, float c12, - float c20, float c21, float c22) : + float c10, float c11, float c12, + float c20, float c21, float c22) : Matrix(3, 3) { Dcm &dcm = *this; - dcm(0,0) = c00; - dcm(0,1) = c01; - dcm(0,2) = c02; - dcm(1,0) = c10; - dcm(1,1) = c11; - dcm(1,2) = c12; - dcm(2,0) = c20; - dcm(2,1) = c21; - dcm(2,2) = c22; + dcm(0, 0) = c00; + dcm(0, 1) = c01; + dcm(0, 2) = c02; + dcm(1, 0) = c10; + dcm(1, 1) = c11; + dcm(1, 2) = c12; + dcm(2, 0) = c20; + dcm(2, 1) = c21; + dcm(2, 2) = c22; } Dcm::Dcm(const float *data) : @@ -138,16 +138,16 @@ int __EXPORT dcmTest() Matrix::identity(3))); // quaternion ctor ASSERT(matrixEqual( - Dcm(Quaternion(0.983347f, 0.034271f, 0.106021f, 0.143572f)), - Dcm( 0.9362934f, -0.2750958f, 0.2183507f, - 0.2896295f, 0.9564251f, -0.0369570f, - -0.1986693f, 0.0978434f, 0.9751703f))); + Dcm(Quaternion(0.983347f, 0.034271f, 0.106021f, 0.143572f)), + Dcm(0.9362934f, -0.2750958f, 0.2183507f, + 0.2896295f, 0.9564251f, -0.0369570f, + -0.1986693f, 0.0978434f, 0.9751703f))); // euler angle ctor ASSERT(matrixEqual( - Dcm(EulerAngles(0.1f, 0.2f, 0.3f)), - Dcm( 0.9362934f, -0.2750958f, 0.2183507f, - 0.2896295f, 0.9564251f, -0.0369570f, - -0.1986693f, 0.0978434f, 0.9751703f))); + Dcm(EulerAngles(0.1f, 0.2f, 0.3f)), + Dcm(0.9362934f, -0.2750958f, 0.2183507f, + 0.2896295f, 0.9564251f, -0.0369570f, + -0.1986693f, 0.0978434f, 0.9751703f))); // rotations Vector3 vB(1, 2, 3); ASSERT(vectorEqual(Vector3(-2.0f, 1.0f, 3.0f), diff --git a/apps/mathlib/math/Dcm.hpp b/apps/mathlib/math/Dcm.hpp index 781933e9e..28d840b10 100644 --- a/apps/mathlib/math/Dcm.hpp +++ b/apps/mathlib/math/Dcm.hpp @@ -68,8 +68,8 @@ public: * scalar ctor */ Dcm(float c00, float c01, float c02, - float c10, float c11, float c12, - float c20, float c21, float c22); + float c10, float c11, float c12, + float c20, float c21, float c22); /** * data ctor diff --git a/apps/mathlib/math/EulerAngles.cpp b/apps/mathlib/math/EulerAngles.cpp index 16864aec2..2e96fef4c 100644 --- a/apps/mathlib/math/EulerAngles.cpp +++ b/apps/mathlib/math/EulerAngles.cpp @@ -107,17 +107,17 @@ int __EXPORT eulerAnglesTest() // test dcm ctor euler = Dcm(EulerAngles(0.1f, 0.2f, 0.3f)); - ASSERT(vectorEqual(Vector3(0.1f, 0.2f, 0.3f),euler)); + ASSERT(vectorEqual(Vector3(0.1f, 0.2f, 0.3f), euler)); // test quat ctor euler = Quaternion(EulerAngles(0.1f, 0.2f, 0.3f)); - ASSERT(vectorEqual(Vector3(0.1f, 0.2f, 0.3f),euler)); + ASSERT(vectorEqual(Vector3(0.1f, 0.2f, 0.3f), euler)); // test assignment euler.setPhi(0.4f); euler.setTheta(0.5f); euler.setPsi(0.6f); - ASSERT(vectorEqual(Vector3(0.4f, 0.5f, 0.6f),euler)); + ASSERT(vectorEqual(Vector3(0.4f, 0.5f, 0.6f), euler)); printf("PASS\n"); return 0; diff --git a/apps/mathlib/math/Quaternion.cpp b/apps/mathlib/math/Quaternion.cpp index 161b9d039..78481b286 100644 --- a/apps/mathlib/math/Quaternion.cpp +++ b/apps/mathlib/math/Quaternion.cpp @@ -82,13 +82,13 @@ Quaternion::Quaternion(const Dcm &dcm) : // avoiding singularities by not using // division equations setA(0.5 * sqrt(1.0 + - double( dcm(0, 0) + dcm(1, 1) + dcm(2, 2)))); + double(dcm(0, 0) + dcm(1, 1) + dcm(2, 2)))); setB(0.5 * sqrt(1.0 + - double( dcm(0, 0) - dcm(1, 1) - dcm(2, 2)))); + double(dcm(0, 0) - dcm(1, 1) - dcm(2, 2)))); setC(0.5 * sqrt(1.0 + - double(-dcm(0, 0) + dcm(1, 1) - dcm(2, 2)))); + double(-dcm(0, 0) + dcm(1, 1) - dcm(2, 2)))); setD(0.5 * sqrt(1.0 + - double(-dcm(0, 0) - dcm(1, 1) + dcm(2, 2)))); + double(-dcm(0, 0) - dcm(1, 1) + dcm(2, 2)))); } Quaternion::Quaternion(const EulerAngles &euler) : |