mirror of
https://github.com/ArduPilot/ardupilot
synced 2025-01-03 06:28:27 -04:00
AP_Math: make vector3 xy() method return a reference
This commit is contained in:
parent
4d7bb82f9e
commit
fe4abc521a
@ -617,13 +617,6 @@ bool Vector3<T>::segment_plane_intersect(const Vector3<T>& seg_start, const Vect
|
||||
return true;
|
||||
}
|
||||
|
||||
// return xy components of a vector3
|
||||
template <typename T>
|
||||
Vector2<T> Vector3<T>::xy()
|
||||
{
|
||||
return Vector2<T>{x,y};
|
||||
}
|
||||
|
||||
// define for float and double
|
||||
template class Vector3<float>;
|
||||
template class Vector3<double>;
|
||||
|
@ -192,9 +192,15 @@ public:
|
||||
// rotate vector by angle in radians in xy plane leaving z untouched
|
||||
void rotate_xy(float rotation_rad);
|
||||
|
||||
// return xy components of a vector3
|
||||
Vector2<T> xy();
|
||||
|
||||
// return xy components of a vector3 as a vector2.
|
||||
// this returns a reference to the original vector3 xy data
|
||||
const Vector2<T> &xy() const {
|
||||
return *(const Vector2<T> *)this;
|
||||
}
|
||||
Vector2<T> &xy() {
|
||||
return *(Vector2<T> *)this;
|
||||
}
|
||||
|
||||
// gets the length of this vector squared
|
||||
T length_squared() const
|
||||
{
|
||||
|
Loading…
Reference in New Issue
Block a user