16
$\begingroup$

Bug introduced in 11.2.0


Functions for derived geometric regions (RegionUnion and related) have been significantly updated in MMA 11.2 and now this simple example doesn't work any more as expected. Could this be a bug or I am using the functions in the wrong way?

d[radius_Real] := Disk[{0, 0}, radius];
r[size_Real] := Rectangle[-{size, size}, {size, size}]

$Version
Region[
 RegionUnion[
  RegionDifference[r[4.], r[3.]],
  RegionDifference[d[2.], d[1.]]
  ],
 ImageSize -> 200,
 PlotRange -> All
 ]

In version 11.1.1 I get the expected region shape. version_11.1.1

And this is result of version 11.2. Also ToElementMesh fails to create a mesh from this region. (However, it does work if I replace the arguments of r and d with exact numbers.)

version_11.2

$\endgroup$
  • $\begingroup$ I think it is a bug ... $\endgroup$ – Szabolcs Oct 3 '17 at 8:37
  • $\begingroup$ Wolfram Technical support confirmed that this is a bug ([CASE:3952103]). $\endgroup$ – Pinti Oct 6 '17 at 7:35
10
$\begingroup$

I think this is a bug.

Notice that applying BoundaryDiscretizeRegion to your region shows an error:

BoundaryDiscretizeRegion::defbnds: Unable to compute bounds for the region. Using default bounds of {-1, 1} in all dimensions.

Trying RegionBounds on it returns no result.

This explains the strange output.

However, changing RegionDifference[d[2.], d[1.]] to Region@RegionDifference[d[2.], d[1.]] "fixes" the problem. Now everything works fine.

Region does not seem to change the structure of RegionDifference[d[2.], d[1.]].

My conclusion is that this might be a bug. I would not expect different results when Region is or isn't used, only perhaps different performance (as Region is able to do certain checks a single time, and then guarantee that whatever it contains is a correctly defined region).

I suggest you report this to Wolfram Support.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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