I had a similar experience. I was writing a polygon intersection algorithm, heavily optimized for the domain of inputs, but kept having issues when vertices were coincident or when edges were colinear. I spent days trying to fix it, until I decided to just truncate the vertex values to some good-enough level of precision, and add a random unique jitter to each value (past the truncated precision). This made sure that there were never coincident or colinear situations. Then I just truncated the resulting intersection points again to remove the jitter.
It was trivial to add, and it was faster than all the extra checks I'd have to do for the edge cases. Also, it gave me peace of mind, since I knew it worked in theory, instead of my other feeble attempts which worked most of the time, but always failed in some new edge case.
It was trivial to add, and it was faster than all the extra checks I'd have to do for the edge cases. Also, it gave me peace of mind, since I knew it worked in theory, instead of my other feeble attempts which worked most of the time, but always failed in some new edge case.