Plotting different Regions in RevolutionPlot3D [closed]

sorry this might be a trivial question, but I can't find a neat way to express this plot in simple terms. I am sure there is a better way than to 'boole everything else out', because I have to adjust the plot range manually every time and it is just not the nice way to code.

RegionFunction does not seem to work properly with RevolutionPlot3D (it seems to act on the 'plotted-y-axis' rather than on the circumferential coordinate (theta).

.

I1 = Pi/2;
f1 = Cos[Pi*r];
f2 = Sin[Pi*r];
f3 = Sin[2*Pi*r];
f4 = 1 - Cos[2*Pi*r];
I1 =  Pi/2;
l1 = \[Theta] >= I1;
l2 = 1*I1 >=   \[Theta] ||  \[Theta] >= 2*I1;
l3 = 2*I1 >=  \[Theta] || \[Theta] >= 3*I1;
l4 = 3*I1 >=  \[Theta];
RevolutionPlot3D[{{f1 - Boole[l1]*100}, {f2 - 100*Boole[l2]}, {f3 -
100*Boole[l3]}, {f4 - 100*Boole[l4]}}, {r, 0, 1}, {\[Theta], 0,
2*Pi}, PlotRange -> {{-1, 1}, {-1, 1}, {-2, 2}},
PlotLegends -> {"f1", "f2", "f3", "f4"}]


Thank you very much in advance for every possible idea / solution.

Best P

• Maybe Show? reference.wolfram.com/language/ref/Show.html – mattiav27 Mar 30 '17 at 19:05
• I don't see a RegionFunction in your code.... Here's an example of it working: RevolutionPlot3D[t^4 - t^2, {t, 0, 1}, RegionFunction -> Function[{x, y, z}, -.2 < z < -.1]] – Jason B. Mar 30 '17 at 19:46
• @JasonB: The OP notes that region function works for $x$, $y$, and $z$, but he would prefer a simple and natural reliance on $\theta$ and $r$. – David G. Stork Mar 30 '17 at 19:55
• @DavidG.Stork - I still think it could be clearer what is meant, but that's simple to fix RevolutionPlot3D[{Sin[t], t}, {t, 0, 2 Pi}, {\[Theta], 0, 2 Pi}, RegionFunction -> Function[{x, y, z, t, \[Theta]}, \[Pi]/2 < \[Theta] < 3 \[Pi]/2]] – Jason B. Mar 30 '17 at 20:00
• Thanks for the working example of RegionFunction, because I was using the same variable twice, which caused an error. Question solved. – Paul Saturday Mar 30 '17 at 20:05

RegionFunction takes 6 arguments, x,y,z,t,theta,r , so a function of angle is like this:

RevolutionPlot3D[{f1}, {r, 0, 1}, {\[Theta], 0, 2*Pi},
PlotRange -> {{-1, 1}, {-1, 1}, {-2, 2}},
PlotLegends -> {"f1", "f2", "f3", "f4"},
RegionFunction :> (0 < #5 < Pi/2 &)]


this is in the docs for RevolutionPlot3D, under Options RegionFunction

I don't see how to specify different RegionFunction's for different functions so to make your original its like this:

Show[MapThread[
RevolutionPlot3D[#1, {r, 0, 1}, {\[Theta], 0, 2*Pi},
RegionFunction -> #2, PlotStyle -> #3] &,
Transpose[{
{f1, 0 < #5 < Pi/2 &, Red},
{f2, Pi/2 < #5 < Pi &, Green},
{f2, Pi < #5 < 3 Pi/2 &, Blue},
{f2, 3 Pi/2 < #5 < 2 Pi &, Black}
}]], PlotRange -> {{-1, 1}, {-1, 1}, {-2, 2}}]


(and really i don't think the Boole approach is so bad..)