remove sleep calls, change some for loops to list comp, move isPointOnLine to base vector
This commit is contained in:
@@ -192,6 +192,26 @@ Vector3<_Precision> Vector3<_Precision>::Cross(const Vector3<_Precision>& rcVct)
|
||||
return cVctRes;
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
bool Vector3<_Precision>::IsOnLine (const Vector3<_Precision>& startVct, const Vector3<_Precision>& endVct) const
|
||||
{
|
||||
Vector3<_Precision> vectorAB = endVct - startVct;
|
||||
Vector3<_Precision> vectorAC = *this - startVct;
|
||||
Vector3<_Precision> crossproduct = vectorAB.Cross(vectorAC);
|
||||
_Precision dotproduct = vectorAB.Dot(vectorAC);
|
||||
|
||||
if (crossproduct.Length() > traits_type::epsilon())
|
||||
return false;
|
||||
|
||||
if (dotproduct < 0)
|
||||
return false;
|
||||
|
||||
if (dotproduct > vectorAB.Length() * vectorAB.Length())
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
template <class _Precision>
|
||||
bool Vector3<_Precision>::operator != (const Vector3<_Precision>& rcVct) const
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user