maths: add sinc functions
This commit is contained in:
parent
2fcc16646c
commit
3e9f5efbe0
19
maths.hpp
19
maths.hpp
@ -193,16 +193,21 @@ to_radians [[gnu::pure]] (T degrees)
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//-----------------------------------------------------------------------------
|
//! Normalised sinc function
|
||||||
constexpr float
|
template <typename T>
|
||||||
to_radians [[gnu::pure]] (float degrees) {
|
constexpr T
|
||||||
return degrees / 180 * static_cast<float> (PI_f);
|
sincn [[gnu::pure]] (T x)
|
||||||
|
{
|
||||||
|
return std::sin (constants<T>::PI * x) / (constants<T>::PI * x);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
constexpr double
|
//! Unnormalised sinc function
|
||||||
to_radians [[gnu::pure]] (double degrees) {
|
template <typename T>
|
||||||
return degrees / 180 * PI_d;
|
constexpr T
|
||||||
|
sincu [[gnu::pure]] (T x)
|
||||||
|
{
|
||||||
|
return std::sin (x) / x;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user