Skip to main content
Made code more concise
Source Link
ubpdqn
  • 64.8k
  • 3
  • 65
  • 154

Discretizing polygons first then difference facilitates. Apologies if I have misunderstood issue.

pol = Cases[region, Line[x__] :> xPolygon[x], Infinity];
r = Polygon /@ pol;
rm = RegionDifference @@ (DiscretizeRegion /@ rpol);
rmf = RegionMember[rm]
mx = Max[pol[[1, All, #]]] & /@ {1, 2};
mn = Min[pol[[1, All, #]]] & /@ {1, 2};
Manipulate[
 Column[{Show[Graphics[Point[p]], RegionPlot[rm, PlotStyle -> c], 
    PlotRange -> Transpose[{mn, mx}], ImageSize -> 400], 
   If[rmf[p], c = Red; "True", c = Black; 
    "False"]}], {{p, {34.56, -86.2}}, Locator}]

enter image description here

Discretizing polygons first then difference facilitates. Apologies if I have misunderstood issue.

pol = Cases[region, Line[x__] :> x, Infinity];
r = Polygon /@ pol;
rm = RegionDifference @@ (DiscretizeRegion /@ r);
rmf = RegionMember[rm]
mx = Max[pol[[1, All, #]]] & /@ {1, 2};
mn = Min[pol[[1, All, #]]] & /@ {1, 2};
Manipulate[
 Column[{Show[Graphics[Point[p]], RegionPlot[rm, PlotStyle -> c], 
    PlotRange -> Transpose[{mn, mx}], ImageSize -> 400], 
   If[rmf[p], c = Red; "True", c = Black; 
    "False"]}], {{p, {34.56, -86.2}}, Locator}]

enter image description here

Discretizing polygons first then difference facilitates. Apologies if I have misunderstood issue.

pol = Cases[region, Line[x__] :> Polygon[x], Infinity];
rm = RegionDifference @@ (DiscretizeRegion /@ pol);
rmf = RegionMember[rm]
mx = Max[pol[[1, All, #]]] & /@ {1, 2};
mn = Min[pol[[1, All, #]]] & /@ {1, 2};
Manipulate[
 Column[{Show[Graphics[Point[p]], RegionPlot[rm, PlotStyle -> c], 
    PlotRange -> Transpose[{mn, mx}], ImageSize -> 400], 
   If[rmf[p], c = Red; "True", c = Black; 
    "False"]}], {{p, {34.56, -86.2}}, Locator}]

enter image description here

Source Link
ubpdqn
  • 64.8k
  • 3
  • 65
  • 154

Discretizing polygons first then difference facilitates. Apologies if I have misunderstood issue.

pol = Cases[region, Line[x__] :> x, Infinity];
r = Polygon /@ pol;
rm = RegionDifference @@ (DiscretizeRegion /@ r);
rmf = RegionMember[rm]
mx = Max[pol[[1, All, #]]] & /@ {1, 2};
mn = Min[pol[[1, All, #]]] & /@ {1, 2};
Manipulate[
 Column[{Show[Graphics[Point[p]], RegionPlot[rm, PlotStyle -> c], 
    PlotRange -> Transpose[{mn, mx}], ImageSize -> 400], 
   If[rmf[p], c = Red; "True", c = Black; 
    "False"]}], {{p, {34.56, -86.2}}, Locator}]

enter image description here