You have no understanding of the problem domain; and, no idea how to understand the code you have found.
Try again to do what I suggested and if you can understand the results you should see a fix.
Run the original program with the new test data and you should see what should be edited in doIntersect.
Tim S.