I am dealing with polygons admitted by using other region functions (like RegionDifference
), some of which have insidious problems.
Consider those below;
pA = Polygon[{{45.36842200621874, -19.99999846732962}, {46., -92.}, {45., -93.}, {98., -151.}, {202., -162.6389941886955}, {202., -115.45591028150943}, {165., -116.}, {120., -49.}, {120.62032087153082, -19.999999255934014}}];
pB = Polygon[{{98., -151.}, {66.58627519630939, -116.62271625256498}, {55.79313759815469, -104.8113581262825}, {50.39656879907734, -98.90567906314125}, {49.278708119268465, -97.68235982863342}}];
Note that pB
is very thin and is a result of RegionDifference
being infamously unreliable. So to visualise it below, I'll draw a thick line between its points.
I now wish to find the intersection of these Polygons, but alas, calling
RegionIntersection[pA, pB]
takes 303 seconds to spit out error:
BoundaryMeshRegion::dupbcl: The cell Line[{{2,1}}] was given in more than one boundary.
Clearly pB
is malformed and an adversarial input for RegionIntersection
. What exactly is wrong with it, and is there a way I can efficiently determine it is a bogus output of RegionDifference
to be discarded?