AP_Math: vector2f::length_squared always returns float
This commit is contained in:
parent
46617e6c72
commit
4c4de1f021
@ -20,6 +20,12 @@
|
||||
|
||||
#include "AP_Math.h"
|
||||
|
||||
template <typename T>
|
||||
float Vector2<T>::length_squared() const
|
||||
{
|
||||
return (float)(x*x + y*y);
|
||||
}
|
||||
|
||||
template <typename T>
|
||||
float Vector2<T>::length(void) const
|
||||
{
|
||||
@ -244,6 +250,7 @@ bool Vector2<T>::circle_segment_intersection(const Vector2<T>& seg_start, const
|
||||
}
|
||||
|
||||
// only define for float
|
||||
template float Vector2<float>::length_squared(void) const;
|
||||
template float Vector2<float>::length(void) const;
|
||||
template float Vector2<float>::operator *(const Vector2<float> &v) const;
|
||||
template float Vector2<float>::operator %(const Vector2<float> &v) const;
|
||||
|
@ -131,10 +131,7 @@ struct Vector2
|
||||
}
|
||||
|
||||
// gets the length of this vector squared
|
||||
T length_squared() const
|
||||
{
|
||||
return (T)(*this * *this);
|
||||
}
|
||||
float length_squared() const;
|
||||
|
||||
// gets the length of this vector
|
||||
float length(void) const;
|
||||
|
Loading…
Reference in New Issue
Block a user