By the way, I had a teacher (J.P Reveilès) who had invented the theoretically fastest drawline algorithm ever: he simply figure out that, for a line, there is a pixel pattern which repeat itself (unless the variation is a transcendental number http://en.wikipedia.org/wiki/Transcendental_number ) so you only have to compute that pattern once and copy/paste it. If I remember well, for example, a line which has a variat…
Wouldn't the exception be for lines whose slope is irrational? (i.e. that can't be represented by a ratio of integers), so the repeating pattern is analogous to the repeating pattern in a decimal representation of a rational number.
The Beauty of Bresenham's Algorithm
21–30 of 50 posts
Re: The Beauty of Bresenham's Algorithm
#22Basically, you model your map using a grid, after firing a sensor such as a LIDAR or sonar and finding something blocks its cone of sight you use Bresenham's to see what cells in your map the new reading provides information about. (i.e. something bouncing 2 meters from where your robot is not only tells you about a block at 2 meters but also about no block in that trajectory, all those cells you now suppose are free and the one you suppose is not are the result of Bressenham's Algorithm)
Re: The Beauty of Bresenham's Algorithm
#23Earlier quoted context omitted.
Wouldn't the exception be for lines whose slope is irrational? (i.e. that can't be represented by a ratio of integers), so the repeating pattern is analogous to the repeating pattern in a decimal representation of a rational number.
How does a computer distinguish an irrational number from a good, (necessarily rational) floating-point approximation of one?
Re: The Beauty of Bresenham's Algorithm
#24Re: The Beauty of Bresenham's Algorithm
#25Re: The Beauty of Bresenham's Algorithm
#26Why do people write non-conditional loops as "for(;;)" instead of "while(1)"?
Because while(1) still has a condition that is checked on every loop iteration when optimizations are disabled. for(;;) can be read as "forever".
Re: The Beauty of Bresenham's Algorithm
#27By the way, I had a teacher (J.P Reveilès) who had invented the theoretically fastest drawline algorithm ever: he simply figure out that, for a line, there is a pixel pattern which repeat itself (unless the variation is a transcendental number http://en.wikipedia.org/wiki/Transcendental_number ) so you only have to compute that pattern once and copy/paste it. If I remember well, for example, a line which has a variat…
Wouldn't the exception be for lines whose slope is irrational? (i.e. that can't be represented by a ratio of integers), so the repeating pattern is analogous to the repeating pattern in a decimal representation of a rational number.
Re: The Beauty of Bresenham's Algorithm
#28Earlier quoted context omitted.
Wouldn't the exception be for lines whose slope is irrational? (i.e. that can't be represented by a ratio of integers), so the repeating pattern is analogous to the repeating pattern in a decimal representation of a rational number.
How does a computer distinguish an irrational number from a good, (necessarily rational) floating-point approximation of one?
Re: The Beauty of Bresenham's Algorithm
#29Why do people write non-conditional loops as "for(;;)" instead of "while(1)"?