Speed up ContourPlot3D
Nasser gives good standard ControlActive
approach. But that by definition looses quality during motion. I just would like to share a trick that avoids that. Most of the time is spent on rendering your bell shape. But it is static. Plane moves but it is simple, so it should not all the time trigger recomputing of static bell shape. You can separate motion of plane from bells shape with Dynamic. This will allow you to move without loss of quality during motion.
Manipulate[
Show[
ContourPlot3D[
z == 10*x*y*Exp[-x - y], {x, 0, 6}, {y, 0, 6}, {z, 0, 3},
ContourStyle -> Red, Mesh -> None, PerformanceGoal -> "Quality"],
Graphics3D[{FaceForm[Directive[Blue, Opacity[.5]]],
EdgeForm[Directive[Thick, Blue]],
Dynamic@Polygon[{{0, 0, k}, {0, 6, k}, {6, 6, k}, {6, 0, k}}]}],
AxesOrigin -> {0, 0, 0}, Boxed -> False,
AxesStyle -> Directive[Thick], ViewPoint -> {-4, -8, 4},
ImageSize -> {420, 370}]
, {{k, 0.5, Text@Style["k", Italic, FontSize -> 18]}, 0, 1.35, 0.01,
Appearance -> "Labeled"}, SynchronousUpdating -> False]
You can speed things up by using ControlActive
on some of the options which slows down things. Like this
Manipulate[
ContourPlot3D[{z == 10*x*y*Exp[-x - y], z == k}, {x, 0, 6}, {y, 0, 6}, {z, 0, 3},
ContourStyle -> {Red, Opacity[0.9]}, AxesOrigin -> {0, 0, 0},
Boxed -> False, Mesh -> None,
PerformanceGoal -> ControlActive["Speed", "Quality"],
Contours -> ControlActive[3, 10],
PlotPoints -> ControlActive[3, 10],
MeshStyle -> Directive[Thick],
AxesStyle -> Directive[Thick],
BoundaryStyle -> Directive[Blue],
ContourStyle -> Opacity[0.8],
ViewPoint -> {-4, -8, 4},
ImageSize -> {420, 370}],
{{k, 0.5, Text@Style["k", Italic, FontSize -> 18]}, 0, 1.35, 0.01,
Appearance -> "Labeled", ContinuousAction -> True}
]
If you also change ContinuousAction -> True
to False
that will speed it up more.
see http://reference.wolfram.com/mathematica/tutorial/AdvancedDynamicFunctionality.html
The idea is to wrap those options which can slow down things using ControlActive
with values that are low as first argument, which will cause the plot to update fast as the slider is moving, but when the slider stops, the second argument is used giving the better final looking plot (but slower to render)
The nature of the function you've provided makes ContourPlot3D
an overkill. Use Plot3D
and set the ViewPoint -> 100 {-4, -8, 4}
a little further to make the z
axis straight.
Manipulate[
Show[Plot3D[10*x*y*Exp[-x - y], {x, 0, 6}, {y, 0, 6}, Mesh -> None, PlotStyle -> Red],
Graphics3D[{FaceForm[Directive[Blue, Opacity[.5]]], EdgeForm[Directive[Thick, Blue]],
Dynamic@Polygon[{{0, 0, k}, {0, 6, k}, {6, 6, k}, {6, 0, k}}]}],
AxesOrigin -> {0, 0, 0}, Boxed -> False, ViewPoint -> 100 {-4, -8, 4},
ImageSize -> {420, 370}, AxesStyle -> Directive[Thick]],
{{k, 0.5, Text@Style["k", 18]}, 0, 1.35, 0.01, Appearance -> "Labeled"},
SynchronousUpdating -> False]