Added ray/line segment intersection test