Use a horizontal ray, as in http://rosettacode.org/wiki/Ray-casting_algorithm