MayaFlux 0.4.0
Digital-First Multimedia Processing Framework
Loading...
Searching...
No Matches

◆ deadzone()

template<typename T >
constexpr T MayaFlux::Kinesis::deadzone ( x,
threshold 
)
constexprnoexcept

Zero values within [-threshold, threshold] and rescale the remainder to fill [0, 1] (or [-1, 1] for negative inputs).

Standard controller/HID deadzone. Input and output are in [-1, 1]. threshold must be in [0, 1).

Example: deadzone(0.1F, 0.2F) -> 0.0F (inside dead zone) deadzone(0.6F, 0.2F) -> 0.5F (rescaled from [0.2, 1.0] to [0, 1])

Definition at line 244 of file Scalar.hpp.

245{
246 if (std::abs(x) <= threshold)
247 return T { 0 };
248 const T sign = x > T { 0 } ? T { 1 } : T { -1 };
249 return sign * (std::abs(x) - threshold) / (T { 1 } - threshold);
250}
Tendency< D, float > threshold(const Tendency< D, float > &t, float thresh)
Zero output below threshold, pass through above.
Definition Tendency.hpp:141

References threshold().

+ Here is the call graph for this function: