Hi,
once you re-order the last test polygon in main.cpp, the current code fails.
Please rotate vertices until xmin vertex 250,485 gets towards the beginning.
First, it unveils that rangeA and rangeC arguments of case 9 line 74 are swapped.
Once this is fixed, case 10 doesn't converge anymore. Runs forever.
Looks like your code relies on rangeA being in some specific quadrants, and doesn't accept all possible combinations.
What has been your assumption in mind when developing the code?