I am implementing a 2D football game. For my pass algorithm, I calculate the slope between the passer and reciever with the equation m = (y2-y1)/(x2-x1)
In some conditions x2
and x1
are equal resulting in a divide by zero exception. What should I do in this case?
I did not ask this question on math.stackexchange.com because it's a programming question.