3
$\begingroup$

I used one of the examples in the documentation, but by trying all three versions, V12.0, V13.2, V13.3.0, they all ran as follows:

disks = RegionUnion[Disk[{0, 0}, 2], Disk[{6, 0}, 2], Disk[{3, 5}, 2]];
RegionDifference[disks, Triangle[{{0, 0}, {6, 0}, {3, 5}}]] // Region

enter image description here

But the ideal effect should be this:

enter image description here

$\endgroup$
3
  • $\begingroup$ RegionPlot[rd] where rd is the output of RegionDifference. This shows that the region has been calculated correctly. In your code change Region to RegionPlot. $\endgroup$
    – Syed
    Nov 8, 2023 at 4:43
  • $\begingroup$ Well, this site isn't for bug reporting, please report this to WRI: wolfram.com/support/contact/?topic=feedback It'll definitely be on-topic if you ask for a work-around, though. $\endgroup$
    – xzczd
    Nov 8, 2023 at 4:49
  • $\begingroup$ Indeed, I was initially trying to react to a problem that came up in the docs, and really shouldn't have posted the problem on MSE, but now the problem I can't delete...... $\endgroup$
    – Vancheers
    Nov 8, 2023 at 8:30

2 Answers 2

6
$\begingroup$

With simple regions, sometimes CSGRegion is better:

CSGRegion[
  "Difference", 
  {CSGRegion["Union", {Disk[{0, 0}, 2], Disk[{6, 0}, 2], Disk[{3, 5}, 2]}], 
   Triangle[{{0, 0}, {6, 0}, {3, 5}}]}]
$\endgroup$
4
$\begingroup$

Use DiscretizeGraphics

$Version

(* "13.3.1 for Mac OS X ARM (64-bit) (July 24, 2023)" *)

Clear["Global`*"]

disks = RegionUnion[
   Disk[{0, 0}, 2],
   Disk[{6, 0}, 2], Disk[{3, 5}, 2]];

RegionDifference[disks, Triangle[{{0, 0}, {6, 0}, {3, 5}}]] // Region

enter image description here

disks = RegionUnion[
   Disk[{0, 0}, 2] // DiscretizeGraphics,
   Disk[{6, 0}, 2] // DiscretizeGraphics, 
   Disk[{3, 5}, 2] // DiscretizeGraphics];

RegionDifference[disks, Triangle[{{0, 0}, {6, 0}, {3, 5}}]] // Region

enter image description here

$\endgroup$

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.