diff options
Diffstat (limited to 'compat')
-rw-r--r-- | compat/euler.cpp | 10 | ||||
-rw-r--r-- | compat/math-imports.hpp | 23 |
2 files changed, 14 insertions, 19 deletions
diff --git a/compat/euler.cpp b/compat/euler.cpp index f02365c9..a868478e 100644 --- a/compat/euler.cpp +++ b/compat/euler.cpp @@ -1,13 +1,11 @@ #include "euler.hpp" +#include "math-imports.hpp" #include <cmath> namespace euler { euler_t OTR_COMPAT_EXPORT rmat_to_euler(const rmat& 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) @@ -31,9 +29,6 @@ rmat OTR_COMPAT_EXPORT euler_to_rmat(const euler_t& input) 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); @@ -63,9 +58,6 @@ void OTR_COMPAT_EXPORT tait_bryan_to_matrices(const euler_t& input, rmat& r_pitch, rmat& r_yaw) { - using std::cos; - using std::sin; - { const double phi = -input(2); const double sin_phi = sin(phi); diff --git a/compat/math-imports.hpp b/compat/math-imports.hpp index ad70f361..e4175b16 100644 --- a/compat/math-imports.hpp +++ b/compat/math-imports.hpp @@ -1,10 +1,12 @@ #pragma once -#include <cmath> -#include <cinttypes> - -namespace otr_math +template <typename T> +static inline constexpr auto signum(T x) { + return (T() < x) - (x < T()); +} + +#include <cmath> using std::copysign; @@ -27,19 +29,20 @@ using std::tan; using std::round; using std::fmod; +#include <cinttypes> + using std::uintptr_t; using std::intptr_t; using std::int64_t; using std::int32_t; +using std::int8_t; using std::uint64_t; using std::uint32_t; +using std::uint8_t; -template <typename T> -static inline constexpr auto signum(T x) -{ - return (T() < x) - (x < T()); -} +#include <algorithm> -} // ns otr_math +using std::min; +using std::max; |