# Why can't Mathematica draw a consistent mesh on a torus?

All 3 images are produced using ParametricPlot3D The left example is produced with no extra options. Note that the black lines, which is all I really want to see, cut in and out and are not connected. In the right example, the colors are gone, but the mesh lines are still broken up and the picture looks terrible. In the middle frame, I've tried changing the PlotStyle so the faces are only 0.8 opaque. This helps, but I don't want the surface to be transparent. How can I draw a simple black and white mesh picture of a torus?

Code for middle picture:

SetOptions[ParametricPlot3D,
Axes->False,
Boxed->False,
Mesh->20,
Lighting -> {White},
PlotStyle->FaceForm[{White,Opacity[0.8]}]
]
ParametricPlot3D[
{Cos[u]*(Sqrt[2]+Cos[t]), Sin[u]*(Sqrt[2]+Cos[t]),Sin[t]
},
{u,0,2Pi},{t,0,2Pi}]

• adding the options PlotStyle->None, Mesh -> {20, 20} and BoundaryStyle -> Black seems to work in v9 (windows 10) and v11.3 (wolfram cloud). – kglr Jul 31 '18 at 3:18
• @kgir Those options yield a transparent torus (for me), not an opaque one (my goal). Can you post your image? – edgeloss Jul 31 '18 at 3:35
• edgeloss, sorry i missed your requirement. Do the options PlotStyle -> White, and Lighting -> "Neutral" help? – kglr Jul 31 '18 at 3:41
• Unfortunately not. – edgeloss Jul 31 '18 at 3:59
• What version of Mathematica and what hardware are you using under what operating system? – Anton Antonov Jul 31 '18 at 8:12

## 1 Answer

I think you can do this:

ParametricPlot3D[{Cos[u]*(Sqrt[2] + Cos[t]),
Sin[u]*(Sqrt[2] + Cos[t]), Sin[t]}, {u, 0, 2 Pi + Pi/10}, {t, 0,
2 Pi + Pi/10}, Axes -> False, Boxed -> False, Mesh -> 20,
PlotStyle -> Glow[White], MeshStyle -> Thick,
PlotPoints -> 100]


The main point is is to use Glow in the PlotStyle option to make the white surface independent of the lighting.

I also added a fix for another annoying shortcoming: the Mesh lines are drawn at subdivisions of the periodicity interval that leave a gap, unless you extend the parameter ranges by one interval size ($2\pi/n$ where $n$ is the number specified in the Mesh option).

Finally, I increased PlotPoints to make the lines smoother.

Instead of extending the parameter intervals, you can also fix the gaps in the mesh lines by adding BoundaryStyle:

ParametricPlot3D[{Cos[u]*(Sqrt[2] + Cos[t]),
Sin[u]*(Sqrt[2] + Cos[t]), Sin[t]}, {u, 0, 2 Pi}, {t, 0, 2 Pi},
Axes -> False, Boxed -> False, Mesh -> 20, PlotStyle -> Glow[White],
MeshStyle -> Thick, PlotPoints -> 100, BoundaryStyle -> Thick]


The ends of the torus surface in the given parametrization are considered a boundary curve and therefore don't get a mesh line. The BoundaryStyle -> Thick option adds lines where the mesh is missing.

• g= ParametricPlot3D[{Cos[u]*(Sqrt[2] + Cos[t]), Sin[u]*(Sqrt[2] + Cos[t]), Sin[t]}, {u, 0, 2 Pi + Pi/10}, {t, 0, 2 Pi + Pi/10}, Axes -> False, Boxed -> False, Mesh -> 20, PlotStyle -> Glow[White], MeshStyle -> Thick, PlotPoints -> 100] Works well, except when I try Export["pic.pdf",g] the image is as attached. i.stack.imgur.com/tsd14.png – edgeloss Jul 31 '18 at 5:47
• @edgeloss. If I export to pdf, MMA 11.3 give me a nice torus.On Windows 8.1 64 bit.Jens code works perfect. – Mariusz Iwaniuk Jul 31 '18 at 8:57