mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-31 04:58:30 -04:00
AP_Math: allow vector3 and matrix3 objects to be used as arrays
This commit is contained in:
parent
519a26691e
commit
828eed1984
@ -125,6 +125,12 @@ public:
|
||||
return *this = *this / num;
|
||||
}
|
||||
|
||||
// allow a Matrix3 to be used as an array of vectors, 0 indexed
|
||||
Vector3<T> & operator[](uint8_t i) {
|
||||
Vector3<T> *_v = &a;
|
||||
return _v[i];
|
||||
}
|
||||
|
||||
// multiplication by a vector
|
||||
Vector3<T> operator *(const Vector3<T> &v) const;
|
||||
|
||||
|
@ -111,6 +111,12 @@ public:
|
||||
// uniform scaling
|
||||
Vector3<T> &operator /=(const T num);
|
||||
|
||||
// allow a vector3 to be used as an array, 0 indexed
|
||||
T & operator[](uint8_t i) {
|
||||
T *_v = &x;
|
||||
return _v[i];
|
||||
}
|
||||
|
||||
// dot product
|
||||
T operator *(const Vector3<T> &v) const;
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user