9 #ifndef SE_MATH_UTIL_HPP 10 #define SE_MATH_UTIL_HPP 14 #include <Eigen/Dense> 35 static inline T
fracf(
const T& v);
38 static inline T
floorf(
const T& v);
41 static inline T
fabs(
const T& v);
43 template<
typename Scalar>
44 static constexpr
inline Scalar
sq(Scalar a);
46 template<
typename Scalar>
47 static constexpr
inline Scalar
cu(Scalar a);
49 template<
typename Scalar>
50 static inline bool in(
const Scalar v,
const Scalar a,
const Scalar b);
52 static inline Eigen::Vector3f
to_translation(
const Eigen::Matrix4f& T);
54 static inline Eigen::Matrix3f
to_rotation(
const Eigen::Matrix4f& T);
60 static inline Eigen::Matrix4f
to_transformation(
const Eigen::Matrix3f& R,
const Eigen::Vector3f& t);
69 static inline typename std::enable_if<std::is_arithmetic<T>::value, T>::type
70 clamp(
const T& f,
const T& a,
const T& b);
72 static inline void clamp(Eigen::Ref<Eigen::VectorXf> res,
73 const Eigen::Ref<const Eigen::VectorXf> a,
74 const Eigen::Ref<Eigen::VectorXf> b);
76 template<
typename R,
typename A,
typename B>
78 clamp(Eigen::MatrixBase<R>& res,
const Eigen::MatrixBase<A>& a,
const Eigen::MatrixBase<B>& b);
83 static Eigen::Vector3f
84 plane_normal(
const Eigen::Vector3f& p1,
const Eigen::Vector3f& p2,
const Eigen::Vector3f& p3);
98 static T
median(std::vector<T>& data);
122 static T
median(
const std::vector<T>& data);
143 static Eigen::Matrix3f
hat(
const Eigen::Vector3f& omega);
145 static Eigen::Matrix3f
exp_and_theta(
const Eigen::Vector3f& omega,
float& theta);
160 static Eigen::Matrix4f
exp(
const Eigen::Matrix<float, 6, 1>& a);
169 #include "impl/math_util_impl.hpp" 173 #endif // SE_MATH_UTIL_HPP static constexpr Scalar sq(Scalar a)
static Eigen::Matrix3f to_inverse_rotation(const Eigen::Matrix4f &T)
static Eigen::Matrix3f to_rotation(const Eigen::Matrix4f &T)
static Eigen::Vector3f plane_normal(const Eigen::Vector3f &p1, const Eigen::Vector3f &p2, const Eigen::Vector3f &p3)
Compute the normal vector of a plane defined by 3 points.
static std::enable_if< std::is_arithmetic< T >::value, T >::type clamp(const T &f, const T &a, const T &b)
static Eigen::Matrix3f exp_and_theta(const Eigen::Vector3f &omega, float &theta)
static Eigen::Matrix4f exp(const Eigen::Matrix< float, 6, 1 > &a)
Group exponential.
static Eigen::Matrix3f hat(const Eigen::Vector3f &omega)
hat-operator
static T almost_median(std::vector< T > &data)
Compute the median of the data in the vector.
static T median(std::vector< T > &data)
Compute the median of the data in the vector.
static Eigen::Vector3f to_translation(const Eigen::Matrix4f &T)
static T fracf(const T &v)
static T fabs(const T &v)
static unsigned power_two_up(const float x)
static bool in(const Scalar v, const Scalar a, const Scalar b)
static Eigen::Vector3f to_inverse_translation(const Eigen::Matrix4f &T)
static Eigen::Matrix4f to_transformation(const Eigen::Vector3f &t)
static Eigen::Matrix4f to_inverse_transformation(const Eigen::Matrix4f &T)
Helper wrapper to allocate and de-allocate octants in the octree.
Definition: colour_utils.hpp:17
constexpr bool is_power_of_two< unsigned >(const unsigned x)
static constexpr Scalar cu(Scalar a)
constexpr int log2_const(int n)
static T floorf(const T &v)
constexpr bool is_power_of_two(T)