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

◆ soft_clip()

template<typename T >
T MayaFlux::Kinesis::soft_clip ( T  x,
T  limit = T { 1 } 
)
inlinenoexcept

Smooth bound to (-limit, limit): limit * tanh(x / limit).

Close to the identity for small |x|, approaches +-limit for large |x|. A non-positive limit gives zero.

Definition at line 198 of file Scalar.hpp.

198 { 1 }) noexcept
199{
200 if (limit <= T { 0 })
201 return T { 0 };
202 return limit * std::tanh(x / limit);
203}