remove sleep calls, change some for loops to list comp, move isPointOnLine to base vector

This commit is contained in:
Eric Trombly
2020-03-25 15:05:08 -05:00
parent 3ff9a068d7
commit 5f648aa2c1
5 changed files with 82 additions and 39 deletions

View File

@@ -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
{