public static Vector GetNormalToVector(Vector pos, Vector ballPos, Vector ballDirection) { var hypotenuse = (pos - ballPos); var dotProduct = hypotenuse.Dot(ballDirection); var magnitudeH = Math.Sqrt(hypotenuse.X * hypotenuse.X + hypotenuse.Y * hypotenuse.Y); var magnituteD = Math.Sqrt(ballDirection.X * ballDirection.X + ballDirection.Y * ballDirection.Y); var cos = dotProduct / (magnitudeH * magnituteD); //var angle = Math.Acos(cos); var directionLength = hypotenuse.Length * cos; var scaledDirection = ballDirection.Unit() * directionLength; var result = (ballPos + scaledDirection) - pos; return result; }