Unlike RegionPlot
, RegionPlot3D
copes poorly with logical combinations of predicates (&&
, ||
), which should result in sharp edges in the region to be plotted. Instead, these edges are usually drawn rounded and sometimes with severe aliasing artifacts. This has been observed in many posts on this site:
- Problem in RegionPlot3D
- on RegionPlot3D and ContourPlot3D
- Tailoring RegionPlot3D with PlotPoints?
- "
RegionPlot3D
plots always seem to have that 'home-made' look about them..." - "...the limitations of
RegionPlot3D
make the edges appear jagged."
One solution, as noted by Silvia, by halirutan, and most recently by Jens, is to use a ContourPlot3D
instead with an appropriate RegionFunction
, as this produces much higher-quality results. I think it would be useful to have a general-purpose solution along these lines. That is, we want a single function that can be used as a drop-in replacement for RegionPlot3D
and will automatically produce high-quality results by setting up the appropriate instances of ContourPlot3D
.
Here is a test example, inspired by this post:
RegionPlot3D[1/4 <= x^2 + y^2 + z^2 <= 1 && (x <= 0 || y >= 0),
{x, -1, 1}, {y, -1, 1}, {z, -1, 1}]
It should look more like this (created by increasing PlotPoints
, and even then the edges are not perfectly sharp):