AP_Math: make is_nan const for quaternion and add .zero() for vector2

This commit is contained in:
Andrew Tridgell 2014-02-20 13:20:36 +11:00
parent 1123c40761
commit 009913ec60
2 changed files with 7 additions and 1 deletions

View File

@ -47,7 +47,7 @@ public:
} }
// check if any elements are NAN // check if any elements are NAN
bool is_nan(void) bool is_nan(void) const
{ {
return isnan(q1) || isnan(q2) || isnan(q3) || isnan(q4); return isnan(q1) || isnan(q2) || isnan(q3) || isnan(q4);
} }

View File

@ -105,6 +105,12 @@ struct Vector2
// check if any elements are infinity // check if any elements are infinity
bool is_inf(void) const; bool is_inf(void) const;
// zero the vector
void zero()
{
x = y = 0;
}
// gets the length of this vector squared // gets the length of this vector squared
T length_squared() const T length_squared() const
{ {