Talk:Simple and accurate LOS function for BlitzMax

From RogueBasin
Revision as of 20:52, 12 June 2008 by Duerig (talk | contribs) (Aha! That's why it can leak through.)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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)