segment intersection test