This seemingly tame solid gives Mathematica (v9) a bit of a workout if you want to generate a good picture:
rinner[y_] = Sqrt[y];
router[y_] = 1;
RegionPlot3D[rinner[y]^2 <= x^2 + z^2 <= router[y]^2,
{x, -1, 1}, {z, -1, 1}, {y, 0, 1}, AxesLabel -> {x, y, z}, PlotPoints -> 100,
PlotStyle -> Opacity[.75], MeshFunctions -> {#3 &}, Mesh -> 5]
I kept increasing PlotPoints
from 100 to 200 to 300 and things get pretty slow---without much of an improvement in the rendering of the choppy part of the region at the top. Bumping up MaxRecursion
and PerformanceGoal->"Quality"
didn't seem to help.
I tried playing with variations like PlotPoints->{100,100,300}
to get better results faster, and this leads to my two questions.
- What else should I try? (I experimented with
RevolutionPlot3D
, but I want solids.) Is it possible to tailor the placement of
PlotPoints
to a subset of either(a) an axis (say, 10x more points in the $z$ direction, but pack them into $0.9\le z\le 1$?, or
(b) a specific portion of the overall space (say, $x,y,z$ with $0.9^2\le x^2+y^2\le 1^2$ and $0.9\le z\le 1$, etc.)?
Thanks for any insight.
Answer
If you want to stick with RegionPlot3D
but don't want the jagged edges, then you can smooth them by excluding the creased line from the plot region:
rinner[y_] = Sqrt[y];
router[y_] = 1;
ε = .05;
RegionPlot3D[(rinner[y])^2 <= x^2 + z^2 <= (router[y])^2 &&
router[y] - rinner[y] > ε, {x, -1, 1}, {z, -1, 1}, {y, 0,
1}, AxesLabel -> {x, y, z}, PlotPoints -> 100,
PlotStyle -> Opacity[.75], MeshFunctions -> {#3 &}, Mesh -> 5]
Edges are always rounded in RegionPlot3D
anyway, so rounding them by hand as I did here with the parameter ε
may be acceptable.
The small parameter ε
determines how close the inner and outer walls are allowed to come - thus preventing them from touching. The choice of PlotPoints
will determine how small you can make ε
.
Comments
Post a Comment