2
$\begingroup$

This question already has an answer here:

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$

marked as duplicate by Jens, Sjoerd C. de Vries, user9660, m_goldberg, MarcoB Jan 26 '16 at 22:02

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • $\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 '16 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 '16 at 18:00
9
$\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$
6
$\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.