I came up with this method to plot the traces of the surface $z=4x^2+y^2$, in this case for $z=1$, 2, 3, and 4.
ContourPlot3D[{z == 4 x^2 + y^2, z == 1, z == 2, z == 3,
z == 4}, {x, -2, 2}, {y, -2, 2}, {z, 0, 4.01},
ContourStyle -> {Opacity[0.3]},
PlotPoints -> 30, MaxRecursion -> 3,
Mesh -> {{1, 2, 3, 4}}, MeshFunctions -> {#3 &},
MeshStyle -> {Thick, Red},
AxesLabel -> {"x", "y", "z"}]
Which produces this image:
I am now looking for a way to hide the surface $z=4x^2+y^2$, but keep the planes and the mesh curves.
Any suggestions?
Update:
Consider obtaining traces for the surface $z=y^2-x^2$ using technique shown by MichaelE2.
ContourPlot3D[z, {x, -2, 2}, {y, -2, 2}, {z, -1.5, 1.5},
Contours -> {-1, 0, 1}, ContourStyle -> {Opacity[0.3]},
PlotPoints -> 30, MaxRecursion -> 3, Mesh -> {{0}},
MeshFunctions -> {Function[{x, y, z}, z - (y^2 - x^2)]},
MeshStyle -> Directive[Thick, Red], AxesLabel -> Automatic]
Image:
ContourPlot3D[x, {x, -2, 2}, {y, -2, 2}, {z, -1.5, 1.5},
Contours -> {-1, 0, 1}, ContourStyle -> {Opacity[0.3]},
PlotPoints -> 30, MaxRecursion -> 3, Mesh -> {{0}},
MeshFunctions -> {Function[{x, y, z}, z - (y^2 - x^2)]},
MeshStyle -> Directive[Thick, Red], AxesLabel -> Automatic]
Image:
ContourPlot3D[y, {x, -2, 2}, {y, -2, 2}, {z, -1.5, 1.5},
Contours -> {-1, 0, 1}, ContourStyle -> {Opacity[0.3]},
PlotPoints -> 30, MaxRecursion -> 3, Mesh -> {{0}},
MeshFunctions -> {Function[{x, y, z}, z - (y^2 - x^2)]},
MeshStyle -> Directive[Thick, Red], AxesLabel -> Automatic]
Image:
I think this gives students a very simple way to get the traces for a quadratic surface.
Answer
You could omit the (paraboloid) surface and use its formula as a mesh function:
ContourPlot3D[z, {x, -2, 2}, {y, -2, 2}, {z, 0, 4.01},
Contours -> Range[4], ContourStyle -> {Opacity[0.3]},
PlotPoints -> 30, MaxRecursion -> 3, Mesh -> {{0}},
MeshFunctions -> {Function[{x, y, z}, z - (4 x^2 + y^2)]},
MeshStyle -> Directive[Thick, Red], AxesLabel -> Automatic]
You may like the simpler approach above, but if you want to get fancy, you could highlight the ellipses.
ContourPlot3D[z, {x, -2, 2}, {y, -2, 2}, {z, 0, 4.01},
Contours -> Range[4], ContourStyle -> {Opacity[0.3]},
PlotPoints -> 30, MaxRecursion -> 3, Mesh -> {Range[0.5, 3.5], {0}},
MeshShading -> {
{Opacity[ 0.2], ##} & @@@
("DefaultPlotStyle" /. (Method /. Charting`ResolvePlotTheme["Default", ContourPlot3D])),
{Opacity[0.7], ##} & @@@
("DefaultPlotStyle" /. (Method /. Charting`ResolvePlotTheme["Default", ContourPlot3D]))
},
MeshFunctions -> {#3 &, Function[{x, y, z}, z - (4 x^2 + y^2)]},
MeshStyle -> Directive[Thick, Red], AxesLabel -> {"x", "y", "z"}]
Comments
Post a Comment