Commenter SyntaxError has spotted and corrected several bugs in the code I presented in my article Raytracing on a Grid; I mention this in case anybody used the first or second pieces of example code as a basis for their own work. The code in the article has been updated and retested.
The core of the problem was that I was failing to account for the fact that zero multiplied by infinity yields an undefined result. This happened when both endpoints had identical horizontal or vertical coordinates, which you'd think I would have caught earlier.
No comments:
Post a Comment