Tweaked Line collision detection.
Fixed bugs with horizontal and vertical lines.

Also refactored the utility method so that it is not redefined every
time hitTest is called.