4

I would like to plot a segment of a circular annulus in three dimensions with constant thickness (like a thick washer, but through some limited ranges of angle). This shows the shape:

RegionPlot3D[
 (5 < Sqrt[x^2 + y^2] < 6 && 5 < z < 6 && 0 < ArcTan[x, y] < .5) ,
 {x, -10, 10}, {y, -10, 10}, {z, -10, 10},
 Mesh -> None,
 PlotPoints -> 100,
 PlotStyle -> Directive[Opacity[0.5], Red]]

Annular segment

However, this requires an extremely high number of PlotPoints (which will be undesirable in my full figure, containing many dozens of such shapes). Moreover I would like to retain the thin edge lines and impose Opacity[], colors, and so forth, as can be applied in all Graphics3D primitives such as Cylinder[].

I could work with Regions, such as this start:

Region[
 RegionDifference[Cylinder[{{0, 0, 0}, {0, 0, 1}}, 1],
  Cylinder[{{0, 0, 0}, {0, 0, 1}}, 1/2]]]

Difference of cylinders

but here too I won't get the thin edge lines and opportunity to adjust the overall opacity and color as I seek.

In two dimensions, there is a perfect graphics element:

Graphics[{Opacity[0.5], Orange, Annulus[{0, 0}, {1/2, 1}, {0, .3}]}]

Orange annulus segment

What I'm seeking would be called Annulus3D. In the absence of such a 3D primitive, how shall I plot what I seek?


Just to show the final result (using the linked code from @kglr, below):

Munsell-like color solid

David G. Stork
  • 41,180
  • 3
  • 34
  • 96

1 Answers1

6

You can use RegionProduct:

rp = RegionProduct[Annulus[{0, 0}, {1/2, 1}, {0, .3}], Line[{{0}, {1/10}}]];

Region[rp]

enter image description here

An alternative approach: Modify the trick in this answer to add a location parameter:

ClearAll[annulus3D]
annulus3D[ctr_, {θ1_, θ2_}, {r1_, r2_}, {z1_, z2_}] := 
   Translate[ 
     ChartElementData["CylindricalSector3D"][{{θ1, θ2}, {r1, r2}, {z1, z2}}, 1], 
     ctr]

Example:

Graphics3D[{EdgeForm[{Thick, Gray}], 
  Opacity[.5, Red], annulus3D[{1, 1, .5}, {Pi/3, 2 Pi/3}, {.5, 1}, {0, .6}], 
  Opacity[.5, Blue], annulus3D[{0, 0, 0}, {Pi/4, 3 Pi/2}, {.25, 1.5}, {.5, .75}]}, 
 Axes -> True, BoxRatios -> 1, AxesOrigin -> {0, 0, 0}]

enter image description here

kglr
  • 394,356
  • 18
  • 477
  • 896