2
$\begingroup$

I tried this:

reg1 = Disk[{0, 0}, 1];
reg2 = Disk[{1, 0}, 1];
reg3 = RegionIntersection[reg1, reg2];

Then this:

Graphics[{
  Opacity[0.5],
  {Red, reg1},
  {Green, reg2},
  {Blue, reg3}
  }]

But it doesn't work because (I think) the RegionIntersection did not send back a Graphics Primitive.

What's the best way to show the intersection of these two disks, including the two disks?

$\endgroup$
2
  • $\begingroup$ If you just want to show the three regions, then why not remove reg3 from your Graphics command? You then have a red circle, a green circle, and some other color showing the intersection. $\endgroup$
    – Cassini
    Jan 26, 2016 at 17:53
  • 5
    $\begingroup$ It looks to me like the main issue you're after is the same as discussed in the following link: How to embed a filled Region in a Graphics? $\endgroup$
    – Jens
    Jan 26, 2016 at 18:00

2 Answers 2

10
$\begingroup$

Use RegionPlot for regions:

reg1 = Disk[{0, 0}, 1];
reg2 = Disk[{1, 0}, 1];
reg3 = RegionIntersection[reg1, reg2];
RegionPlot[{reg1, reg2, reg3},
 AspectRatio -> Automatic,
 BoundaryStyle -> None,
 PlotStyle -> Thread[Directive[Opacity[.5], {Red, Blue, Green}]]]

enter image description here

$\endgroup$
8
$\begingroup$
reg1 = Disk[{0, 0}, 1];

reg2 = Disk[{1, 0}, 1];

Show[Graphics[{Opacity[0.5], {Red, reg1}, {Green, reg2}}],DiscretizeRegion[RegionIntersection[reg1, reg2]]]

enter image description here

$\endgroup$

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