| 123456789101112131415161718192021222324252627282930313233 |
- #ifndef _Fast_Math_H__
- #define _Fast_Math_H__
- // Constants
- #define ONE_BY_SQRT3 (0.57735026919f) // 1/sqrt(3)
- #define TWO_BY_SQRT3 (2.0f * 0.57735026919f)
- #define SQRT3_BY_2 (0.86602540378f)
- #define SQRT3 (1.73205080757f)
- #define SQRT2_BY_SQRT3 (0.8164966f)
- #define M_PI (3.14159265f)
- #ifndef SQ
- #define SQ(x) ((x)*(x))
- #endif
- void fast_sincos(float angle, float *sin, float *cos);
- void fast_norm_angle(float *angle);
- void normal_sincosf(float angle, float *sin, float *cos);
- /**
- * A simple low pass filter.
- *
- * @param value
- * The filtered value.
- *
- * @param sample
- * Next sample.
- *
- * @param filter_constant
- * Filter constant. Range 0.0 to 1.0, where 1.0 gives the unfiltered value.
- */
- #define LowPass_Filter(value, sample, filter_constant) (value -= (filter_constant) * ((value) - (sample)))
- #endif /* _Fast_Math_H__ */
|