2
0
Fork 0
mirror of https://github.com/MartinThoma/LaTeX-examples.git synced 2025-04-26 06:48:04 +02:00
LaTeX-examples/asymptote/torus-three-paths/torus-three-paths.tex

52 lines
1.3 KiB
TeX
Raw Normal View History

2013-12-15 20:05:46 +01:00
\documentclass[margin=1cm]{standalone}
\usepackage{asymptote}
\begin{document}
\begin{asy}
2013-12-17 16:33:14 +01:00
settings.render = 0;
2013-12-15 20:05:46 +01:00
settings.prc = false;
import graph3;
import contour;
size3(8cm);
currentprojection = orthographic(10,1,4);
defaultrender = render(merge = true);
// create torus as surface of rotation
int umax = 40;
int vmax = 40;
surface torus = surface(Circle(c=2Y, r=0.6, normal=X, n=vmax), c=O, axis=Z, n=umax);
torus.ucyclic(true);
torus.vcyclic(true);
pen meshpen = 0.3pt + gray;
draw(torus, surfacepen=material(diffusepen=white+opacity(0.6), emissivepen=white));
for (int u = 0; u < umax; ++u)
draw(torus.uequals(u), p=meshpen);
for (int v = 0; v < vmax; ++v)
draw(graph(new triple(real u) {return torus.point(u,v); }, 0, umax, operator ..),
p=meshpen);
pair a = (floor(umax/2) + 2, 3);
dot(torus.point(a.x, a.y), L="$a$", align=W);
pair b = (5, floor(vmax/2));
dot(torus.point(b.x, b.y), L="$b$", align=2Z + X);
path3 abpath(int ucycles, int vcycles) {
pair bshift = (ucycles*umax, vcycles*vmax);
triple f(real t) {
pair uv = (1-t)*a + t*(b+bshift);
return torus.point(uv.x, uv.y);
}
return graph(f, 0, 1, operator ..);
}
real linewidth = 0.8pt;
draw(abpath(0,0), p=linewidth + orange);
draw(abpath(1,0), p=linewidth + red);
draw(abpath(1,-1), p=linewidth + darkgreen);
\end{asy}
\end{document}