
Reveal
A rather different way of producing cross sections . Here a bunch of parallel lines starting at z=1 and z=-1 move towards the xy-plane, getting hung up on a torus of revolution as they go. The end result is a bunch of cross sections of the torus, now realized as a sort of relief.
Here’s the (super-slow) code, which could undoubtedly be streamlined:
?[s_] := 2 + Cos[s]; ?[s_] := Sin[s];
DynamicModule[{torus, cols, r, s},
torus[x_,
y_] := {?[v] Cos[u], ?[v] Sin[u], ?[v]} /. {u ->
ArcTan[x, y], v -> ArcCos[Sqrt[x^2 + y^2] - 2]};
cols = RGBColor /@ {"#5FC9F3", "#081F37"};
r = 2.7;
Manipulate[
s = 1/2 + 1/2 Cos[?];
ParametricPlot3D[
Table[{x, y,
If[1 < x^2 + y^2 < 9, i Max[s, torus[x, y][[3]]], i s]}, {i, {-1,
1}}, {x, -4.5, 4.5, 1/4}], {y, -4, 4},
PlotStyle -> Directive[Thickness[.003], cols[[1]]],
PlotRange -> {{-4.5, 4.5}, {-4.5, 4.5}, {-1.5, 1.5}},
PlotPoints -> 200, Boxed -> False, Axes -> None,
ViewPoint -> 100 {1, 0, r},
ViewAngle -> ?/(4*100*Sqrt[1 + r^2]), ImageSize -> 540,
Background -> cols[[2]]], {?, 0, ?}]]
