Advertisement
Guest User

Untitled

a guest
Feb 16th, 2020
155
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. settings.outformat="pdf";
  2.  
  3. settings.render = 5;
  4. settings.prc = false;
  5.  
  6. import graph3;
  7. import contour;
  8. size3(8cm);
  9.  
  10. currentprojection = orthographic(9,1,4);
  11. defaultrender = render(merge = true);
  12.  
  13. // create torus as surface of rotation
  14. int umax = 40;
  15. int vmax = 40;
  16. surface torus = surface(Circle(c=2Y, r=0.6, normal=X, n=vmax), c=O, axis=Z, n=umax);
  17. torus.ucyclic(true);
  18. torus.vcyclic(true);
  19.  
  20. pen meshpen = 0.25pt + gray;
  21.  
  22. draw(torus, surfacepen=material(diffusepen=white+opacity(0.001), emissivepen=white));
  23. for (int u = 0; u < umax; ++u)
  24.   draw(torus.uequals(u), p=meshpen);
  25. for (int v = 0; v < vmax; ++v)
  26.   draw(graph(new triple(real u) {return torus.point(u,v); }, 0, umax, operator ..),
  27.        p=meshpen);
  28.  
  29. pair a = (floor(umax/2) + 3, 3);
  30. label(torus.point(a.x, a.y), L="$\phi$", align=W);// L="",
  31. pair b = (5, floor(vmax/2));
  32. //label(torus.point(b.x, b.y), L="",align=2Z + X);// L="",
  33.  
  34. path3 abpath(int ucycles, int vcycles) {
  35.   pair bshift = (ucycles*umax, vcycles*vmax);
  36.   triple f(real t) {
  37.     pair uv = (1-t)*a + t*(b+bshift);
  38.     return torus.point(uv.x, uv.y);
  39.   }
  40.   return graph(f, 0, 1, operator ..);
  41. }
  42.  
  43. real linewidth = 0.8pt;
  44.  
  45. draw(abpath(0,0), p=linewidth + red);
  46. //draw(abpath(-1,0), p=linewidth + green);
  47. draw(abpath(0,1), p=linewidth + red);
  48. //draw(abpath(0,0), p=linewidth + green);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement