3
$\begingroup$

I've been working with some simple polygon regions. When I use RegionSymmetricDifference with these simple 3D regions, it doesn't return an error message, but it fails to return what I expect. Here is what I'm seeing:

p1 = Polygon[N@CirclePoints[{1, 0}, 6]];
p2 = Polygon[N@CirclePoints[{0.5, 0}, 6]];
reg4 = BoundaryMesh[
  RegionProduct[p1, MeshRegion[{{0}, {1.}}, Line[{1, 2}]]]]
reg5 = BoundaryMesh[
  RegionProduct[p2, MeshRegion[{{0}, {1}}, Line[{1, 2}]]]]

Polygons 3D Image

Here is the result of running RegionSymmetricDifference:

reg6 = RegionSymmetricDifference[reg4, reg5]

RegionSymmetricDifference Image

As can be seen, all that returns is a BooleanRegion that is unevaluated. However, if I run RegionDifference, the expected region is returned.

reg7 = RegionDifference[reg4, reg5]

RegionDifference Image

If I run RegionSymmetricDifference on a pair of 2D polgons, it returns what I expect is the correct result:

RegionSymmetricDifference[p1, p2]

RegionSymmetricDifference Image 2D

Any ideas on what I might be doing wrong? Am I misunderstanding the usage of RegionSymmetricDifference?

In the case where BooleanRegion is returned unevaluated, it should be possible to wrap the expression inside Region in order to see the region. The following is what I see. There is an error message, but the kernel continues to run. I didn't wait for it to timeout. I aborted after about 60 seconds.

Region[reg6]

Wrapped in Region image

$\endgroup$

2 Answers 2

4
$\begingroup$

RegionSymmetricDifference is having an issue with the fact that one of the pieces is an empty region. Since as you noted, RegionDifference is working fine, you can work around this issue with:

RegionUnion[
    RegionDifference[reg4, reg5],
    RegionDifference[reg5, reg4]
]

enter image description here

It might be worthwhile reporting this to support.

$\endgroup$
1
  • $\begingroup$ yes, I was thinking I might need to report it to support. I'll wait a bit longer to see if anyone else has more information to add. $\endgroup$
    – david
    Feb 9, 2018 at 16:14
2
$\begingroup$

I submitted this issue to WRI support. They were able to reproduce the problem and have passed it along to the developers. I'm not sure if this affects versions other than 11.2. I the mean time, I will use RegionDifference.

$\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.