Template Function GridKit::Math::linseg
Defined in File CommonMath.hpp
Function Documentation
-
template<class ScalarT, typename RealT>
inline ScalarT GridKit::Math::linseg(const ScalarT x, const RealT lower, const RealT upper, const RealT height) Smooth linear segment contribution.
Smooth approximation to a linear segment contribution that is zero below lower, linear over [lower, upper], and saturated at height above upper. Callers should supply lower < upper; height may be positive or negative.
- Template Parameters:
ScalarT – - scalar data type
RealT – - Real data type (see GridKit::ScalarTraits<ScalarT>::RealT)
- Parameters:
x – [in] - Input signal
lower – [in] - Lower breakpoint
upper – [in] - Upper breakpoint
height – [in] - Saturated value above the upper breakpoint
- Returns:
Smooth linear segment contribution