diff options
-rw-r--r-- | compat/euler.cpp | 59 | ||||
-rw-r--r-- | compat/euler.hpp | 10 |
2 files changed, 0 insertions, 69 deletions
diff --git a/compat/euler.cpp b/compat/euler.cpp index 7c753214..44b34f90 100644 --- a/compat/euler.cpp +++ b/compat/euler.cpp @@ -52,63 +52,4 @@ rmat OTR_COMPAT_EXPORT euler_to_rmat(const euler_t& input) }; } -// https://en.wikipedia.org/wiki/Davenport_chained_rotations#Tait.E2.80.93Bryan_chained_rotations -void OTR_COMPAT_EXPORT tait_bryan_to_matrices(const euler_t& input, - rmat& r_roll, - rmat& r_pitch, - rmat& r_yaw) -{ - { - const double phi = -input(2); - const double sin_phi = sin(phi); - const double cos_phi = cos(phi); - - r_roll = { - 1, 0, 0, - 0, cos_phi, -sin_phi, - 0, sin_phi, cos_phi - }; - } - - { - const double theta = input(1); - const double sin_theta = sin(theta); - const double cos_theta = cos(theta); - - r_pitch = { - cos_theta, 0, -sin_theta, - 0, 1, 0, - sin_theta, 0, cos_theta - }; - } - - { - const double psi = -input(0); - const double sin_psi = sin(psi); - const double cos_psi = cos(psi); - - r_yaw = { - cos_psi, -sin_psi, 0, - sin_psi, cos_psi, 0, - 0, 0, 1 - }; - } -} - -template<int H, int W, typename f = double> -rmat quaternion_to_mat_(const Mat<f, H, W>& q) -{ - const double w = q.w(), x = q.x(), y = q.y(), z = q.z(); - const double ww = w*w, xx = x*x, yy = y*y, zz = z*z; - - return rmat( - ww + xx - yy - zz, 2 * (x*y - w*z), 2 * (x*z + w*y), - 2 * (x*z - w*y), 2 * (y*z + w*x), ww - xx - yy + zz, - 2 * (x*y + w*z), ww - xx + yy - zz, 2 * (y*z - w*x) - ); -} - -rmat OTR_COMPAT_EXPORT quaternion_to_mat(const dmat<1, 4>& q) { return quaternion_to_mat_(q); } -//rmat OTR_COMPAT_EXPORT quaternion_to_mat(const dmat<4, 1>& q) { return quaternion_to_mat_(q); } - } // end ns euler diff --git a/compat/euler.hpp b/compat/euler.hpp index a4c58ffb..d4217a70 100644 --- a/compat/euler.hpp +++ b/compat/euler.hpp @@ -14,22 +14,12 @@ namespace euler { template<int h_, int w_> using dmat = Mat<double, h_, w_>; -using dvec2 = Mat<double, 2, 1>; using dvec3 = Mat<double, 3, 1>; using rmat = dmat<3, 3>; using euler_t = dmat<3, 1>; rmat OTR_COMPAT_EXPORT euler_to_rmat(const euler_t& input); - euler_t OTR_COMPAT_EXPORT rmat_to_euler(const rmat& R); -void OTR_COMPAT_EXPORT tait_bryan_to_matrices(const euler_t& input, - rmat& r_roll, - rmat& r_pitch, - rmat& r_yaw); - -rmat OTR_COMPAT_EXPORT quaternion_to_mat(const dmat<1, 4>& q); -//rmat OTR_COMPAT_EXPORT quaternion_to_mat(const dmat<4, 1>& q); - } // end ns euler |