Creating a robust implementation for segment intersection by refinement: A multistage assignment that defines away degeneracies