% LE TORE

% Ce script crée un tore de rayon de courbure A, de rayon du tube B centré en (C;D;E).

 

A = 2;

B = 1;

C = 0;

D = 0;

E = 0;

 

[t,p] = meshgrid(0:pi/25:2*pi,0:pi/25:2*pi); % Définition de couples (azimut,élévation)

x = (A+B*cos(p)).*cos(t); % Transformation en coordonnées rectangulaires

y = (A+B*cos(p)).*sin(t);

z = B*sin(p);

surf(x+C,y+D,z+E)

 

colormap jet

shading interp

axis image