fix: revise traversal_switch_detector for isolated areas #1350
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Not ready for review
Fixes: issue 1349This is quite a revisal. Issue #1349 was caused by a logic error, and not by a precision error. It was easily fixed by removing the (in hindsight weird) condition (added by me) to reverse the meaning of isolated.
But that caused the original issue again. I made an inverse case of that one as well, and that failed anyway (also with its earlier "fix") for difference.
I decided to go for another way to detect isolation, which is now clearer - but even then not that easy. Below some cases for reference.Below some pictures of intersections (blue, green: input, turquoise: both (= intersection), dotted red/green: resulting intersection.
Case 869 (only ii turns)

Case 128 (with a separate polygon connected as "multiple" with only ii turns (turn 6,9,18), it should not be isolated)
Case 141 (idem but it should be isolated and the "multiple" region inside (turn 13,14) is a separate polygon)
Case case_recursive_boxes_81 which looks the same, but here it are two outer polygons with a part (at turn 26, 27, 42)