3
$\begingroup$

I have created a set of contour lines on a torus, but am unable to make some of them join up, even when increasing the number of points dramatically. Is there a sensible way to do this?

Show[ContourPlot3D[y^2 == 1 - (Sqrt[x^2 + z^2] - 3)^2, {x, -4, 4}, {y, -4, 4}, {z, -4, 0}, Boxed -> False, Axes -> False, Mesh -> False, ContourStyle -> Opacity[0.5]],     {ParametricPlot3D[{{-Sqrt[10 - #^2 - y^2 - 6 Sqrt[1 - y^2]], y, #}, {-Sqrt[10 - #^2 - y^2 + 6 Sqrt[1 - y^2]], y, #}, {Sqrt[10 - #^2 - y^2 - 6 Sqrt[1 - y^2]], y, #}, {Sqrt[10 - #^2 - y^2 + 6 Sqrt[1 - y^2]], y, #}}, {y, -4, 4}, PlotStyle -> {{Thick, Black}}, PlotPoints -> 100]}&/@Range[-4, 0, 0.5], PlotRange -> {{-5, 5}, {-5, 5}, {-4, 0}},BoxRatios -> {1, 1, 0.5}, ImageSize -> 1000]

The output is:

contour lines on a semi-torus

where it's clear that the contours aren't quite joining up as they should be. Any help on this would be great.

$\endgroup$

1 Answer 1

6
$\begingroup$

Try MeshFunctions inside ContourPlot3D:

ContourPlot3D[y^2 == 1 - (Sqrt[x^2 + z^2] - 3)^2, {x, -4, 4}, {y, -4, 4}, {z, -4, 0}, Boxed -> False, Axes -> False, MeshFunctions -> {#3 &}, ContourStyle -> Opacity[0.5]]

enter image description here

$\endgroup$
2
  • $\begingroup$ Absolutely perfect, thank you! $\endgroup$ Jul 7, 2022 at 9:03
  • $\begingroup$ You're welcome ! $\endgroup$ Jul 7, 2022 at 9:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.