mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-02-22 07:44:03 -04:00
AP_Math: add operator[] to Vector2
This commit is contained in:
parent
db665e6de7
commit
b6d0b028c3
@ -107,6 +107,14 @@ struct Vector2
|
||||
// check if all elements are zero
|
||||
bool is_zero(void) const { return (fabsf(x) < FLT_EPSILON) && (fabsf(y) < FLT_EPSILON); }
|
||||
|
||||
const T & operator[](uint8_t i) const {
|
||||
const T *_v = &x;
|
||||
#if MATH_CHECK_INDEXES
|
||||
assert(i >= 0 && i < 2);
|
||||
#endif
|
||||
return _v[i];
|
||||
}
|
||||
|
||||
// zero the vector
|
||||
void zero()
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user