@brief Scales @value from linear to logarithmic. Value should be within [0,1]
| 212 | //! @brief Scales @value from linear to logarithmic. |
| 213 | //! Value should be within [0,1] |
| 214 | static inline float logToLinearScale( float min, float max, float value ) |
| 215 | { |
| 216 | if( min < 0 ) |
| 217 | { |
| 218 | const float mmax = qMax( qAbs( min ), qAbs( max ) ); |
| 219 | const float val = value * ( max - min ) + min; |
| 220 | float result = signedPowf( val / mmax, F_E ) * mmax; |
| 221 | return isnan( result ) ? 0 : result; |
| 222 | } |
| 223 | float result = powf( value, F_E ) * ( max - min ) + min; |
| 224 | return isnan( result ) ? 0 : result; |
| 225 | } |
| 226 | |
| 227 | |
| 228 | //! @brief Scales value from logarithmic to linear. Value should be in min-max range. |
no test coverage detected