Currently I'm doing this
public static Vector2 Project(this Vector2 A, Vector2 B)
{
if (A.X != 0f || A.Y != 0)
return Vector2.Multiply(A, Vector2.Dot(A, B) / Vector2.Dot(A, A));
else
return A;
//return B; ???
}
Without the zero length check in there every thing blows up because this method returns an effectively infinite length vector. What is the best thing to return when the length of A is zero?