38 template <typename Q = T, typename std::enable_if_t<std::is_integral<Q>::value,
int> = 0>
39 static constexpr bool almostEqual(Q v1, Q v2)
44 template <typename Q = T, typename std::enable_if_t<std::is_floating_point<Q>::value,
int> = 0>
45 static constexpr Q almostEqualMaxHelper(Q v1, Q v2)
47 return std::max<Q>({ 1.0, std::fabs(v1), std::fabs(v2) });
50 template <typename Q = T, typename std::enable_if_t<std::is_floating_point<Q>::value,
int> = 0>
51 static constexpr bool almostEqual(Q v1, Q v2)
53 return std::fabs(v1 - v2) <= std::numeric_limits<Q>::epsilon() * almostEqualMaxHelper(v1, v2);
56 template <typename Q = T, typename std::enable_if_t<std::is_integral<Q>::value,
int> = 0>
57 constexpr bool validateInc(Q v)
const
59 if (m_inc != 0 && (v % m_inc) != 0)
66 template <typename Q = T, typename std::enable_if_t<std::is_floating_point<Q>::value,
int> = 0>
67 constexpr bool validateInc(Q v)
const
69 if (!almostEqual<Q>(m_inc, 0) && !almostEqual<Q>(std::fmod(v, m_inc), 0))
87 constexpr Range(T min, T max, T inc)
104 if (almostEqual(min, max))
159 if (value < m_min || value > m_max)
164 return validateInc<T>(value);
The exception thrown when passing an invalid parameter to a function.
Definition peak_ipl_exception.hpp:80
constexpr T Minimum() const
Get the minimum value for the range.
Definition peak_ipl_range.hpp:115
constexpr std::tuple< T, T, T > GetRange() const
Get the range as tuple.
Definition peak_ipl_range.hpp:145
constexpr Range(T min, T max, T inc)
Constructor for the Range.
Definition peak_ipl_range.hpp:87
constexpr T Increment() const
Get the increment value for the range.
Definition peak_ipl_range.hpp:135
constexpr bool InRange(T value) const
Check if the value is in range.
Definition peak_ipl_range.hpp:157
constexpr T Maximum() const
Get the maximum value for the range.
Definition peak_ipl_range.hpp:125
The "peak::ipl" namespace contains the whole image processing library.
#define PEAK_IPL_NO_DISCARD
Definition peak_ipl_attribute_defines.h:25