1 #ifndef SLAM_CTOR_CORE_MATH_UTILS_H 2 #define SLAM_CTOR_CORE_MATH_UTILS_H 11 #define CONSTEXPR constexpr 18 return std::abs(a - b) <= eps;
24 double eps_scale = std::max(1.0, std::max(std::abs(a), std::abs(b)));
25 constexpr
double Eps = 1e-7;
30 constexpr
double Eps = std::numeric_limits<double>::epsilon();
36 double ratio = value / factor;
37 return are_equal(ratio, std::trunc(ratio));
40 inline double bound_value(
double left,
double v,
double right) {
41 return std::max(left, std::min(right, v));
56 constexpr
inline double deg2rad(
double angle_deg) {
57 return angle_deg * M_PI / 180;
60 constexpr
inline double rad2deg(
double angle_rad) {
61 return angle_rad * 180 / M_PI;
CONSTEXPR bool is_multiple_of(double value, double factor)
CONSTEXPR bool are_equal(const T &a, const T &b, const T &eps)
CONSTEXPR int ge_pow(int i)
constexpr double rad2deg(double angle_rad)
bool are_ordered(double a, double b, double c)
double bound_value(double left, double v, double right)
bool less_or_equal(double a, double b)
CONSTEXPR bool less(double a, double b)
constexpr double deg2rad(double angle_deg)
bool are_strictly_ordered(double a, double b, double c)