2
$\begingroup$

If a region which is drawn by Region function is a 2D area, we can see the region. However, if a region is a 3D region, we sometimes cannot see the region when the region is inside of something because there seems to be no option to make it transparent for Region function. I use Mathematica 11.1.1.0 on Windows7.


For example, If the region I want to draw is a 2D area, Region show us what we want:

region = Disk[{0, 0}, 1];
complement = BooleanRegion[Not, {region}];
Region[complement]

2D case

However, if the region is a 3D region, Region does not give us a relevant draw:

region2 = Ball[{0, 0, 0}, 1];
complement2 = BooleanRegion[Not, {region2}];
Region[complement2]

3D case

Then, do you know any good workaround for this frustrating matter? I know if I convert the region into a set of inequality equations, I can use RegionPlot function and the function has an opacity option but I want to know other solutions.

Any advise is appreciated.

$\endgroup$

1 Answer 1

3
$\begingroup$

You could cheat and convert into a (Boundary)MeshRegion, and then use MeshCellStyle.

I'll use a more interesting example:

region2 = Ball[{0, 0, 0}, 1];
complement2 = BooleanRegion[Not, {region2}];
reg = Region[complement2];

BoundaryDiscretizeRegion[reg, MeshCellStyle -> {{2, All} -> Opacity[1/2]}]

discretized region

$\endgroup$
5
  • $\begingroup$ Oh, I also misunderstood about Sphere, it doesn't contain the balk region. $\endgroup$ Commented Mar 20, 2018 at 6:04
  • $\begingroup$ This does not appear to work anymore in Mathematica 12.1 $\endgroup$
    – alessandro
    Commented Dec 10, 2020 at 23:49
  • $\begingroup$ BoundaryDiscretizeRegion[reg, MeshCellStyle -> {{All} -> Opacity[0.5]}] will make the box transparent (though the mesh is visible), but rather than a sphere, a tiny triangle appears inside of it... $\endgroup$
    – alessandro
    Commented Dec 10, 2020 at 23:55
  • $\begingroup$ It's slightly easier to see the tiny tetrahedron(?) with Show[reg, PlotRange -> {All, 0}]. $\endgroup$
    – alessandro
    Commented Dec 10, 2020 at 23:59
  • $\begingroup$ @alessandro, indeed, a lot seems to have changed in intervening versions... o well. $\endgroup$ Commented Dec 23, 2020 at 10:43

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.