27 #ifndef RL_MATH_TYPETRAITS_H
28 #define RL_MATH_TYPETRAITS_H
30 #define EIGEN_MATRIXBASE_PLUGIN <rl/math/MatrixBaseAddons.h>
31 #define EIGEN_QUATERNIONBASE_PLUGIN <rl/math/QuaternionBaseAddons.h>
32 #define EIGEN_TRANSFORM_PLUGIN <rl/math/TransformAddons.h>
45 static T
Constant(const ::std::size_t& i,
const T& value)
50 static T
Zero(const ::std::size_t& i)
55 static T
abs(
const T& t)
60 static bool equal(
const T& lhs,
const T& rhs,
const T& epsilon = ::Eigen::NumTraits<T>::dummy_precision())
62 return ::std::abs(lhs - rhs) < epsilon;
75 static ::std::size_t
size(
const T& t)
86 template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
87 class TypeTraits< ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>>
90 static ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>
Constant(const ::std::size_t& i,
const Scalar& value)
92 return ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>::Constant(i, value);
95 static ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>
Zero(const ::std::size_t& i)
97 return ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>::Zero(i);
100 static ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>
abs(const ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
105 static bool equal(const ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& lhs, const ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& rhs,
const Scalar& epsilon = ::Eigen::NumTraits<Scalar>::dummy_precision())
107 return lhs.isApprox(rhs, epsilon);
110 static Scalar
max_element(const ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
115 static Scalar
min_element(const ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
120 static ::std::size_t
size(const ::Eigen::Array<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
131 template<
typename Scalar,
int Rows,
int Cols,
int Options,
int MaxRows,
int MaxCols>
135 static ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>
Constant(const ::std::size_t& i,
const Scalar& value)
137 return ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>::Constant(i, value);
140 static ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>
Zero(const ::std::size_t& i)
142 return ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>::Zero(i);
145 static ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>
abs(const ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
150 static bool equal(const ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& lhs, const ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& rhs,
const Scalar& epsilon = ::Eigen::NumTraits<Scalar>::dummy_precision())
152 return lhs.isApprox(rhs, epsilon);
155 static Scalar
max_element(const ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
160 static Scalar
min_element(const ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
165 static ::std::size_t
size(const ::Eigen::Matrix<Scalar, Rows, Cols, Options, MaxRows, MaxCols>& t)
178 #endif // RL_MATH_TYPETRAITS_H