0
$\begingroup$

I'm having trouble displaying a hollow cylinder in Mathematica 9. A hollow cylinder looks like this:

hollow cylinder

I tried to use RevolutionPlot3D with a step function. It displays as what I want, but a collection of them in a Show[] is really buggy.

To prevent an X-Y problem, I'll say why I need this shape. I'm making a diagram to show how the integral of a volume of revolution can be approximated by a collection of hollow cylinders, like how the integral of a 1D function can be approximated by a collection of rectangles covering the undergraph.

I want my diagram to look something like this terrible drawing:

enter image description here

A Plot3D bounds the cylinders from above. The whole assembly is shown in a cross section, with one or two cylinders protruding out of the cross section to show what they are supposed to be.

If there is a better way to do this I'm open to that, but if there's some hidden CSG functions in Mathematica that would do the job I would be forever grateful to hear about them

$\endgroup$
  • $\begingroup$ Check out Sketch-type graphics with transparency and dashed hidden lines? $\endgroup$ – user9660 Apr 25 '15 at 8:30
  • 1
    $\begingroup$ This can be done with Show[{RegionPlot3D[ 2.4 < x^2 + y^2 < 4, {x, -2, 2}, {y, -2, 2}, {z, 0, 2}, Mesh -> None], RegionPlot3D[0.5 < x^2 + y^2 < 2, {x, -2, 2}, {y, -2, 2}, {z, 0, 2}, Mesh -> None]}] pretty easily :) $\endgroup$ – Öskå Apr 25 '15 at 8:30
  • $\begingroup$ @Öskå make an answer out of it? !Mathematica graphics $\endgroup$ – chris Apr 25 '15 at 10:26
4
$\begingroup$
myData = {{2, 1, #}, {1, 1, 0}} & /@ Table[1/(n + 2) + .2 RandomReal[], {n, 1, 15}];

SectorChart3D[myData, BoxRatios -> {1, 1, 1},
 ColorFunction -> Function[{x, y, z}, Hue[z]],
 ColorFunctionScaling -> False]

enter image description here

$\endgroup$
  • $\begingroup$ @blacklemon67 Great... glad to help. If you play around with the ColorFunction, you can likely highlight just one ring (red, say), as in your hand sketch. $\endgroup$ – David G. Stork Apr 25 '15 at 11:14

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.