1. Code

Raster Line Iterator

The RasterLineIterator class, when given a start and an end point in a tile-based space, will allow you to iterate over each tile intersected by the line. The tiles are returned in order of their distance from the start point.

This class is useful for raycasting. It will return every tile intersected by the line, unlike e.g. Bresenham's line algorithm which returns the minimum number of pixels needed to form a line between two points.

C#


Comments, bug reports, questions? Send 'em over! forms@brianmacintosh.com