|
|
|
|
@ -160,7 +160,13 @@ class Distance {
|
|
|
|
|
template<class T> static T lineSegmentPointSquared(const Vector3<T>& a, const Vector3<T>& b, const Vector3<T>& point); |
|
|
|
|
}; |
|
|
|
|
|
|
|
|
|
template<class T> T Distance::lineSegmentPoint(const Vector2<T>& a, const Vector2<T>& b, const Vector2<T>& point) { |
|
|
|
|
/** @todoc Remove workaround when Doxygen is sane */ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class T> static |
|
|
|
|
#else |
|
|
|
|
template<class T> |
|
|
|
|
#endif |
|
|
|
|
T Distance::lineSegmentPoint(const Vector2<T>& a, const Vector2<T>& b, const Vector2<T>& point) { |
|
|
|
|
const Vector2<T> pointMinusA = point - a; |
|
|
|
|
const Vector2<T> pointMinusB = point - b; |
|
|
|
|
const Vector2<T> bMinusA = b - a; |
|
|
|
|
@ -180,7 +186,13 @@ template<class T> T Distance::lineSegmentPoint(const Vector2<T>& a, const Vector
|
|
|
|
|
return std::abs(Vector2<T>::cross(bMinusA, -pointMinusA))/std::sqrt(bDistanceA); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> T Distance::lineSegmentPointSquared(const Vector2<T>& a, const Vector2<T>& b, const Vector2<T>& point) { |
|
|
|
|
/** @todoc Remove workaround when Doxygen is sane */ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class T> static |
|
|
|
|
#else |
|
|
|
|
template<class T> |
|
|
|
|
#endif |
|
|
|
|
T Distance::lineSegmentPointSquared(const Vector2<T>& a, const Vector2<T>& b, const Vector2<T>& point) { |
|
|
|
|
const Vector2<T> pointMinusA = point - a; |
|
|
|
|
const Vector2<T> pointMinusB = point - b; |
|
|
|
|
const Vector2<T> bMinusA = b - a; |
|
|
|
|
@ -200,7 +212,13 @@ template<class T> T Distance::lineSegmentPointSquared(const Vector2<T>& a, const
|
|
|
|
|
return Math::pow<2>(Vector2<T>::cross(bMinusA, -pointMinusA))/bDistanceA; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
template<class T> T Distance::lineSegmentPointSquared(const Vector3<T>& a, const Vector3<T>& b, const Vector3<T>& point) { |
|
|
|
|
/** @todoc Remove workaround when Doxygen is sane */ |
|
|
|
|
#ifdef DOXYGEN_GENERATING_OUTPUT |
|
|
|
|
template<class T> static |
|
|
|
|
#else |
|
|
|
|
template<class T> |
|
|
|
|
#endif |
|
|
|
|
T Distance::lineSegmentPointSquared(const Vector3<T>& a, const Vector3<T>& b, const Vector3<T>& point) { |
|
|
|
|
const Vector3<T> pointMinusA = point - a; |
|
|
|
|
const Vector3<T> pointMinusB = point - b; |
|
|
|
|
const T pointDistanceA = pointMinusA.dot(); |
|
|
|
|
|