Consider the code (adapted from here)
h = x^2 + y^2/9 + z^2/4 - 1;
g = z;
ContourPlot3D[
{h == 0, g == 0}, {x, -1, 1}, {y, -3, 3}, {z, -2, 2},
MeshFunctions -> {Function[{x, y, z, f}, h - g]},
MeshStyle -> {{Thick, Blue}}, Mesh -> {{0}},
ContourStyle -> Directive[Orange, Opacity[0.5], Specularity[White, 30]]]
Now I have few ideas on the effect of MeshFunctions
. Anyway, the result is very nice for me.
I'd like to do the same but with a parallel plane with $z=k$ for other values of $k$ (for example, $k=1$).
So I tried the code
h = x^2 + y^2/9 + z^2/4 - 1;
g = z;
k := 1;
ContourPlot3D[
{h == 0, g == k}, {x, -1, 1}, {y, -3, 3}, {z, -2, 2},
MeshFunctions -> {Function[{x, y, z, f}, h - g]},
MeshStyle -> {{Thick, Blue}}, Mesh -> {{0}},
ContourStyle -> Directive[Orange, Opacity[0.5], Specularity[White, 30]]]
and the result was
and (after reading some comments) I discovered that I can plot those two planes together simply using {h == 0, g == k, g == 0}
obtaining
Question: How to get the sphere (to be true, an ellipsoid) together with two or three planes corresponding to different values of $k$ and their intersection (the blue curves) all on the same figure?
ps: I edited the post to help future readings and to follow the rich comments.
BoxRatios
to make it actually look like an ellipsoid. $\endgroup$