Difference between revisions of "Talk:Simple and accurate LOS function for BlitzMax"
Jump to navigation
Jump to search
(Aha! That's why it can leak through.) |
|||
Line 1: | Line 1: | ||
In the normal course of things, rays should never 'leak' through no matter what density you are sending out. Looking at your algorithm, I see that it is because you are increasing both x and y by a fixed amount every iteration. This means that if the line cuts through a square in the right way, then that square will never be checked for being blocked by a given line. The way to correct this is to do something closer to Bresenham's Algorithm. That would make the algorithm a bit more complicated, but would probably reduce artifacts. [[User:Duerig|Duerig]] 22:52, 12 June 2008 (CEST) | In the normal course of things, rays should never 'leak' through no matter what density you are sending out. Looking at your algorithm, I see that it is because you are increasing both x and y by a fixed amount every iteration. This means that if the line cuts through a square in the right way, then that square will never be checked for being blocked by a given line. The way to correct this is to do something closer to Bresenham's Algorithm. That would make the algorithm a bit more complicated, but would probably reduce artifacts. [[User:Duerig|Duerig]] 22:52, 12 June 2008 (CEST) | ||
Good point, | |||
I should point out that with a step size of 0.18, I don't get any kind of visual artifacts and 100% uniform coverage in every map type. |
Latest revision as of 21:16, 12 June 2008
In the normal course of things, rays should never 'leak' through no matter what density you are sending out. Looking at your algorithm, I see that it is because you are increasing both x and y by a fixed amount every iteration. This means that if the line cuts through a square in the right way, then that square will never be checked for being blocked by a given line. The way to correct this is to do something closer to Bresenham's Algorithm. That would make the algorithm a bit more complicated, but would probably reduce artifacts. Duerig 22:52, 12 June 2008 (CEST)
Good point, I should point out that with a step size of 0.18, I don't get any kind of visual artifacts and 100% uniform coverage in every map type.