summaryrefslogtreecommitdiffhomepage
path: root/opentrack/simple-mat.cpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2016-07-25 11:03:27 +0200
committerStanislaw Halik <sthalik@misaki.pl>2016-07-25 11:25:51 +0200
commit8f30029a598ccf99ffee87590f70df7f1f163e02 (patch)
treec2ac6edac47fced22bde73c9d64c6bf2193f52d3 /opentrack/simple-mat.cpp
parent71df21dcc59c2b935f1301dfd9ada1e2c3019f14 (diff)
api/simple-mat: move to logic
Change causes rebuilds of all modules otherwise.
Diffstat (limited to 'opentrack/simple-mat.cpp')
-rw-r--r--opentrack/simple-mat.cpp57
1 files changed, 0 insertions, 57 deletions
diff --git a/opentrack/simple-mat.cpp b/opentrack/simple-mat.cpp
deleted file mode 100644
index ad83a508..00000000
--- a/opentrack/simple-mat.cpp
+++ /dev/null
@@ -1,57 +0,0 @@
-#include "simple-mat.hpp"
-#include "opentrack-compat/pi-constant.hpp"
-#include <cmath>
-
-namespace euler {
-
-euler_t rmat_to_euler(const dmat<3, 3>& R)
-{
- using std::atan2;
- using std::sqrt;
-
- const double cy = sqrt(R(2,2)*R(2, 2) + R(2, 1)*R(2, 1));
- const bool large_enough = cy > 1e-10;
- if (large_enough)
- return euler_t(atan2(-R(2, 1), R(2, 2)),
- atan2(R(2, 0), cy),
- atan2(-R(1, 0), R(0, 0)));
- else
- return euler_t(0.,
- atan2(R(2, 0), cy),
- atan2(R(0, 1), R(1, 1)));
-}
-
-// tait-bryan angles, not euler
-rmat euler_to_rmat(const euler_t& input)
-{
- const double H = input(0);
- const double P = input(1);
- const double B = -input(2);
-
- using std::cos;
- using std::sin;
-
- const auto c1 = cos(H);
- const auto s1 = sin(H);
- const auto c2 = cos(P);
- const auto s2 = sin(P);
- const auto c3 = cos(B);
- const auto s3 = sin(B);
-
- return dmat<3, 3>(
- // z
- c1 * c2,
- c1 * s2 * s3 - c3 * s1,
- s1 * s3 + c1 * c3 * s2,
- // y
- c2 * s1,
- c1 * c3 + s1 * s2 * s3,
- c3 * s1 * s2 - c1 * s3,
- // x
- -s2,
- c2 * s3,
- c2 * c3
- );
-}
-
-} // end ns euler