Austin Schuh | c6423e6 | 2017-02-11 16:56:30 -0800 | [diff] [blame] | 1 | #ifndef FRC971_ZEROING_WRAP_H_ |
| 2 | #define FRC971_ZEROING_WRAP_H_ |
| 3 | |
| 4 | namespace frc971 { |
| 5 | namespace zeroing { |
| 6 | |
| 7 | // Returns a modified value which has been wrapped such that it is +- period/2 |
| 8 | // away from nearest. |
| 9 | double Wrap(double nearest, double value, double period); |
Austin Schuh | 4fae0fc | 2018-03-27 23:51:42 -0700 | [diff] [blame] | 10 | float Wrap(float nearest, float value, float period); |
Austin Schuh | c6423e6 | 2017-02-11 16:56:30 -0800 | [diff] [blame] | 11 | |
Austin Schuh | d82068e | 2019-01-26 20:05:42 -0800 | [diff] [blame] | 12 | inline double UnWrap(double nearest, double value, double period) { |
| 13 | return Wrap(nearest, value, period); |
| 14 | } |
| 15 | inline float UnWrap(float nearest, float value, float period) { |
| 16 | return Wrap(nearest, value, period); |
| 17 | } |
| 18 | |
Austin Schuh | c6423e6 | 2017-02-11 16:56:30 -0800 | [diff] [blame] | 19 | } // namespace zeroing |
| 20 | } // namespace frc971 |
| 21 | |
| 22 | #endif // FRC971_ZEROING_WRAP_H_ |