From e016dca372bf69f3bb4967a8aba374bc04aea3b4 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Sun, 16 Jul 2017 16:57:59 +0200 Subject: compat/math-imports: use it --- compat/euler.cpp | 10 +--------- compat/math-imports.hpp | 23 +++++++++++++---------- 2 files changed, 14 insertions(+), 19 deletions(-) (limited to 'compat') 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 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 -#include - -namespace otr_math +template +static inline constexpr auto signum(T x) { + return (T() < x) - (x < T()); +} + +#include using std::copysign; @@ -27,19 +29,20 @@ using std::tan; using std::round; using std::fmod; +#include + 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 -static inline constexpr auto signum(T x) -{ - return (T() < x) - (x < T()); -} +#include -} // ns otr_math +using std::min; +using std::max; -- cgit v1.2.3