40 template <typename Q = T, typename std::enable_if_t<std::is_integral<Q>::value,
int> = 0>
41 static constexpr bool almostEqual(Q v1, Q v2)
46 template <typename Q = T, typename std::enable_if_t<std::is_floating_point<Q>::value,
int> = 0>
47 static constexpr Q almostEqualMaxHelper(Q v1, Q v2)
49 return std::max<Q>({ 1.0, std::fabs(v1), std::fabs(v2) });
52 template <typename Q = T, typename std::enable_if_t<std::is_floating_point<Q>::value,
int> = 0>
53 static constexpr bool almostEqual(Q v1, Q v2)
55 return std::fabs(v1 - v2) <= std::numeric_limits<Q>::epsilon() * almostEqualMaxHelper(v1, v2);
58 template <typename Q = T, typename std::enable_if_t<std::is_integral<Q>::value,
int> = 0>
59 constexpr bool validateInc(Q v)
const
61 if (m_inc != 0 && (v % m_inc) != 0)
68 template <typename Q = T, typename std::enable_if_t<std::is_floating_point<Q>::value,
int> = 0>
69 constexpr bool validateInc(Q v)
const
71 if (!almostEqual<Q>(m_inc, 0) && !almostEqual<Q>(std::fmod(v, m_inc), 0))
89 constexpr Range(T min, T max, T inc)
106 if (almostEqual(min, max))
161 if (value < m_min || value > m_max)
166 return validateInc<T>(value);
The exception thrown when passing an invalid parameter to a function.
Definition peak_ipl_exception.hpp:84
constexpr T Minimum() const
Get the minimum value for the range.
Definition peak_ipl_range.hpp:117
constexpr std::tuple< T, T, T > GetRange() const
Get the range as tuple.
Definition peak_ipl_range.hpp:147
constexpr Range(T min, T max, T inc)
Constructor for the Range.
Definition peak_ipl_range.hpp:89
constexpr T Increment() const
Get the increment value for the range.
Definition peak_ipl_range.hpp:137
constexpr bool InRange(T value) const
Check if the value is in range.
Definition peak_ipl_range.hpp:159
constexpr T Maximum() const
Get the maximum value for the range.
Definition peak_ipl_range.hpp:127
The "peak::ipl" namespace contains the whole image processing library.
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_attribute_defines.h:25