Data source: http://rosettacode.org/wiki/Ray-casting_algorithm