Closed JuhaLaukala closed 2 years ago
Sorry for such a late response! I took your tests and submitted #157 as an alternative, can you check it out?
Looks good; better than my workaround.
The below is more like a memo / random notes for later about my findings - in case there is new problems related.
splitPolygon should in this case actually join the polygons (as documented in the function) - not split in this case.
If that applies - you dont need to filter both bridge and bridgeReverse - as that might lead to a case that filtering bridgeReverse will filter out the node that bridge is holding. Not sure if that can happen in real life.
Could also make sense to move the filtering before joining holes (and filter only the bridge). Or filter after creating all the bridges.
Now its a bit messy as the method tries to do two things at the same time (join holes and do filtering with no obvious benefits).
The outerNode was filtered out of both filteredBridge and bridgeReverse; still returned from eliminateHole() method. I dont know why filtering is done three times (once more after returning to eliminateHoles() method).
This specific issue would be solved by just returning bridgeReverse when getting that from splitPolygon; thus filtering only once - but there might be other concerns.
Safe fix (or probably workaround) would be to fix the removed node method to point itself and fix the use of removed node.