| 32 | // BEGIN internal helper functions |
| 33 | |
| 34 | static inline qreal wrap(qreal a, qreal d = 1.0) |
| 35 | { |
| 36 | qreal r = fmod(a, d); |
| 37 | return (r < 0.0 ? d + r : (r > 0.0 ? r : 0.0)); |
| 38 | } |
| 39 | |
| 40 | // normalize: like qBound(a, 0.0, 1.0) but without needing the args and with |
| 41 | // "safer" behavior on NaN (isnan(a) -> return 0.0) |