Hi All:
I’m working on a demonstration for my Calculus class on Volumes, with washers and cylindrical shells.
The code is below, and the main problem I’m having is when I display the simultaneous cylinders (Shell stack), the graphics slow WAY down. I know that this is an intensive calculation, but I feel that the inclusion of this command in the code has slowed everything else down as well, even the Manipulate variables that don’t involve the cylinders.
In particular the “cylStack” list seems to be causing the trouble.
Thanks for any help -- code is below.
Rob
Manipulate[
f[x_] := 1/4 x^4;
g[x_] := 2 x;
(* Defining the function plots *)
fBound = ParametricPlot3D[{{x, 0, f[x]}, {-x, 0, f[x]}}, {x, 0, 2},
PlotStyle -> {Thick, Directive[Dashed, Gray]}];
gBound =
ParametricPlot3D[{{x, 0, g[x]}, {-x, 0, g[x]}}, {x, 0, 2},
PlotStyle -> {Thick, Directive[Dashed, Gray]}];
(* Lines for orientation *)
hLine = Graphics3D[{Red, Thick,
Line[{{1/2 wpos, 0, wpos}, {(4 wpos)^(1/4), 0, wpos}}]}];
vLine = Graphics3D[{Red, Thick,
Line[{{cpos, 0, f[cpos]}, {cpos, 0, g[cpos]}}]}];
(* Lines for Axes *)
axesLine =
Graphics3D[{{Line[{{-2, 0, 0}, {2, 0, 0}}],
Line[{{0, 0, -1}, {0, 0, 4}}]}}];
(* Fill for the region *)
fill = Graphics3D[{
EdgeForm[None], Blue, Opacity[.4],
Polygon[Table[{n, 0, f[n]}, {n, 0.01, 2, .01}]
]}];
(* Defining the Slices *)
washPlot =
RevolutionPlot3D[
wpos, {t, 1/2 wpos, (4 wpos)^(1/4)}, {\[Theta], 0, \[Theta]max},
Mesh -> None, PerformanceGoal :> "Quality"];
cylPlot =
RevolutionPlot3D[{cpos, t}, {t, f[cpos], g[cpos]}, {\[Theta],
0, \[Theta]max}, Mesh -> None, PerformanceGoal :> "Quality",
PlotStyle -> Opacity[.6]];
(* Stacks *)
washStack =
Table[RevolutionPlot3D[n, {t, 1/2 n, (4 n)^(1/4)}, Mesh -> None,
PlotStyle -> Opacity[.5],
BoundaryStyle -> RGBColor[.3, .2, .2, .5]], {n, .1, 3.9, .2}];
cylStack =
Table[RevolutionPlot3D[{n, t}, {t, f[n], g[n]}, Mesh -> None,
PlotStyle -> Opacity[.4],
BoundaryStyle -> RGBColor[.3, 0, .4, .5]], {n, .1, 1.9, .1}] ;
(* For Display *)
Show[fBound, gBound, axesLine, fill,
If[slc == 0, {hLine, washPlot}, {vLine, cylPlot}],
If[wstk, washStack, {}],
If[cstk, cylStack, {}],
(* Global Properties for the SHOW Plot *)
ViewPoint -> {0, -80, 12}, PlotRange -> {{-2, 2}, {-2, 2}, {-1, 4}},
SphericalRegion -> True, Axes -> False, Boxed -> False,
ViewAngle -> .013
],
(* Manipulate Controls *)
{{slc, 0,
"Slice Orientation"}, {0 -> "Horizontal", 1 -> "Vertical"}},
{{wpos, 2, "Horizontal Slice Position"}, .01, 3.99},
{{cpos, 1, "Vertical Slice Position"}, .01, 1.99}, Delimiter,
{{\[Theta]max, .01, "Revolution Angle"}, .01, 2 Pi}, Delimiter,
{{wstk, False, "Show Washer Stack"}, {True, False}},
{{cstk, False, "Show Shell Stack"}, {True, False}},
ControlPlacement -> Left,
TrackedSymbols -> {\[Theta]max, wpos, cpos, slc, wstk, cstk}
]