Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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]

Mathematica graphics

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.

  1. What else should I try? (I experimented with RevolutionPlot3D, but I want solids.)
  2. 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.

share|improve this question
add comment

2 Answers

up vote 8 down vote accepted

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]

rounded

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 ε.

share|improve this answer
    
Very nice--and quick---result. Thanks. –  JohnD Dec 16 '12 at 4:14
add comment

The big problem you have here is, that RegionPlot3D really tries to determine the inner of your object. On the top you have an extremely thin rim and RegionPlot3D would have to find the same rim high on a circular boundary. Too hard, at least for the standard settings.

You could try to plot only the contour of your object:

ContourPlot3D[ {router[y]^2 == x^2 + z^2 , rinner[y]^2 == x^2 + z^2},
   {x, -1, 1}, {z, -1, 1}, {y, 0, 1}, AxesLabel -> {x, y, z}, 
 PlotPoints -> 20, ContourStyle -> Opacity[0.75],
  MeshFunctions -> {#3 &}, Mesh -> 5]

Mathematica graphics

share|improve this answer
    
Well, now this is embarrassing... –  JohnD Dec 16 '12 at 4:10
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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