Fix line segment compilation bug in gcc-4.7
Implement proper ceiling collision