Compare distance to segment instead of crossing