2
$\begingroup$

I would like to clip a Show-command using

Show[{pic1, pic2,...},RegionFunction -> Function[{x, y}, RegionMember[reg] {x, y} ]]

but Mathematica won't evaluate.

Is there a simple workaround to use RegionFunction inside Show? Thanks!

$\endgroup$

1 Answer 1

3
$\begingroup$

You can use a white mask overlaid on top instead.

reg = Region@Disk[{1/3, 1/3}, 1/2];
pic1 = Graphics[{Red, Rotate[Triangle[], 30 Degree]}];
pic2 = Graphics[{Blue, Triangle[]}];

mask = BoundaryDiscretizeRegion[
   RegionDifference[Rectangle[{-3, -3}, {3, 3}], reg], 
   MaxCellMeasure -> 1/30, MeshCellStyle -> {1 -> None, 2 -> White}, 
   Background -> Transparent];

Show[{pic1, pic2, mask}, PlotRange -> {{-1/3, 1}, {-1/3, 1}}]

enter image description here

$\endgroup$
0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.