AP_Math: change is_equal and is_zero to static class for better visability

This commit is contained in:
Tom Pittenger 2015-05-01 23:26:34 -07:00 committed by Andrew Tridgell
parent 3cb2221315
commit c93c773de2
1 changed files with 8 additions and 4 deletions

View File

@ -75,11 +75,15 @@
AP_PARAMDEFV(Matrix3f, Matrix3f, AP_PARAM_MATRIX3F);
AP_PARAMDEFV(Vector3f, Vector3f, AP_PARAM_VECTOR3F);
// are two floats equal
inline bool is_equal(const float fVal1, const float fVal2) { return fabsf(fVal1 - fVal2) < FLT_EPSILON ? true : false; }
class AP_Math {
public:
// are two floats equal
inline bool is_zero(const float fVal1) { return fabsf(fVal1) < FLT_EPSILON ? true : false; }
static inline bool is_equal(const float fVal1, const float fVal2) { return fabsf(fVal1 - fVal2) < FLT_EPSILON ? true : false; }
// is a float is zero
static inline bool is_zero(const float fVal1) { return fabsf(fVal1) < FLT_EPSILON ? true : false; }
};
// a varient of asin() that always gives a valid answer.
float safe_asin(float v);