Pseudosphère

Auteur ou autrice : Toby Thurston.

Mise en ligne le 8 janvier 2025

Image du résultat de l’exemple

Solution à une question sur tex.stackexchange.

On représente ici la pseudosphère comme un solide de révolution construit à partir de la courbe tractrice.

Code


vardef sinh(expr x) = 1/2 (mexp(256x) - mexp(-256x)) enddef;
vardef cosh(expr x) = 1/2 (mexp(256x) + mexp(-256x)) enddef; 
vardef tanh(expr x) = sinh(x)/cosh(x) enddef;

beginfig(1);

  path tractrix;
  tractrix = (0,1) for t = 1/16 step 1/16 until 3: .. (t - tanh(t), 1 / cosh(t)) endfor;
  tractrix := tractrix scaled 30;
  tractrix := subpath (length tractrix, 1) of tractrix reflectedabout(up, down) .. tractrix;
  numeric n; n = length tractrix;

  path c[];
  for i=0 upto n:
    c[i] = fullcircle rotated 90 
         scaled 2 ypart point i of tractrix xscaled 1/6
         shifted (xpart point i of tractrix, 0);
  endfor

  for i = 0 upto 8:
    draw point i/2 of c0 for j=1 upto n: .. point i/2 of c[j] endfor 
      if i mod 8 > 0: withpen pencircle scaled 1/8 fi;
  endfor

  for i = 0 step 2 until n: 
      draw subpath (0, 4) of c[i] 
        if i>0: withpen pencircle scaled 1/8 fi;
  endfor

  % hide a few lines, then redraw the ones in front
  unfill subpath (0, 4) of c[n/2] -- subpath (4,0) of c[n/2 + 8] -- cycle;
  for i = 0 upto 8:
    draw point i/2 of c[n/2] for j=1 upto 8: .. point i/2 of c[n/2 + j] endfor 
      if i mod 8 > 0:
         withpen pencircle scaled 1/8
      fi;
  endfor

  draw subpath (0, 4) of c[n/2];
  draw c[n];

  currentpicture := currentpicture rotated 80;

endfig;

end.

Mots clés : 3Drévolutionsubpathlength

Fichiers

Télécharger l’archive complète