47 #ifndef _MIRA_TRUNCATE_H_ 48 #define _MIRA_TRUNCATE_H_ 51 #include <type_traits> 71 static_assert(std::is_floating_point<T>::value,
"truncate must be used with floating point types");
73 T factor =
std::pow((T)10, (
int)decimals);
77 return std::floor(v) / factor;
82 return std::ceil(v) / factor;
Typedefs for OS independent basic data types.
specialize cv::DataType for our ImgPixel and inherit from cv::DataType<Vec>
Definition: IOService.h:67
T truncate(T value, uint32 decimals)
Truncates a floating point value to a given number of decimals.
Definition: Truncate.h:69
T pow(T base)
Computes the power of 'base' with a constant integral exponent.
Definition: Power.h:104