- Use
RegionDifference
to construct the outer region.
pts = {{-1, 1}, {1, 1}, {10,
10}, {10, -10}, {1, -1}, {-1, -1}, {-10, -10}, {-10, 10}, {-1, 1}};
outreg = TransformedRegion[Rectangle @@ CoordinateBoundingBox[pts],
ScalingTransform[{1.2, 1.2}, Mean[pts]]];
inreg = Polygon[pts];
clip = RegionDifference[outreg, inreg];
Graphics[{{Lighter[Gray, 0.5],
clip}, {EdgeForm[Directive[Red, Dashed, Thickness[0.008]]],
FaceForm[], inreg}}, AspectRatio -> 1/GoldenRatio, Axes -> True]
- Use
Polygon[outpts -> {inpts}]
to get holes.
pts = {{9, 11}, {11, 11}, {20, 15}, {9, -5}, {11, 9}, {9, 9}, {-10,
0}, {0, 20}, {9, 11}};
inpts = Most@pts;
{{xmin, xmax}, {ymin, ymax}} = {MinMax[pts[[;; , 1]]],
MinMax[pts[[;; , 2]]]};
outpts = {{xmin, ymin}, {xmax, ymin}, {xmax, ymax}, {xmin, ymax}};
clip = Polygon[outpts -> {inpts}];
Graphics[{Lighter[Gray, 0.5], clip,
Directive[Red, Dashed, Thickness[0.008]], Line[pts]},
AspectRatio -> 1/GoldenRatio, Axes -> True, PlotRangePadding -> .8]