I'm working on a game with a programmable robot. It uses a laser range finder to get the distance to walls.
I'm using DDA to generate a line from the robot, going in the direction it is pointing, then checking each pixel along the line to see if it hits anything. At that point, the number of pixels checked so far is used as the range, to save having to calculate the proper length.
If the line is horizontal or vertical, then there's no discrepancy, but how greatly does the number of pixels in a line differ from its real length in the worst case?
Notes:
- The length of the line is never just a few pixels, say always at least 50px.
- Longer lines obviously have larger discrepancies, but the question is really about relative differences.