% FOURMI % Ce script nécessite les fonctions: rotation et tube %dessin d'une fourmi %dessin du corps a=0; b=2*pi; c=-pi/2; d=pi/2; [t,u]=meshgrid(a:(b-a)/60:b,c:(d-c)/60:d); x=2.*cos(t).*cos(u); y=sin(t).*cos(u); z=sin(u); surfl(1.5.*x-1,1.5.*y,1.5.*z) hold on surfl(x+3,y,z-1); [t,u]=meshgrid(a:(b-a)/60:b,c:(d-c)/60:d); x=cos(t).*cos(u); y=sin(t).*cos(u); z=sin(u); surfl(x+5,y,z-1); surfl(1.3.*x+6.5,1.3.*y,1.3.*z); %dessin des pates [x,y,z] = tube; x = 3*x; y = 0.1*y; z = 0.1*z; [x,y,z] = rotation(x-1,y+2,z-1,-120,30); surfl(x,y,z) hold on surfl(x,-y,z) shading interp hold on [x,y,z] = tube; x = 3.*x+1.4; y = 0.1.*y+0.6; z = 0.1.*z+2.5; [x,y,z] = rotation(x,y,z,270,300); surfl(x,y,z) hold on surfl(x,-y,z) shading interp axis image hold on %pattes2 [x,y,z] = tube; x = 3*x; y = 0.1*y; z = 0.1*z; [x,y,z] = rotation(x-2.5,y-4.2,z-1.5,90,-35); shading interp surfl(x,y,z) hold on surfl(x,-y,z) [x,y,z] = tube; x = 3.*x; y = 0.1.*y; z = 0.1.*z; [x,y,z] = rotation(x-4.3,y-4.2,z+2.5,90,60); colormap(bone) shading interp surfl(x,y,z) surfl(x,-y,z) % pattes3 [x,y,z] = tube; x = 3*x; y = 0.1*y; z = 0.1*z; [x,y,z] = rotation(x-4.5,y-4,z-2.8,120,-35); shading interp surfl(x,y,z) surfl(x,-y,z) [x,y,z] = tube; x = 3.*x; y = 0.1.*y; z = 0.1.*z; [x,y,z] = rotation(x-5.3,y-4,z+4.8,120,60); colormap(bone) shading interp surfl(x,y,z) surfl(x,-y,z) % articulations des pattes [t,u]=meshgrid(a:(b-a)/60:b,c:(d-c)/60:d); x=cos(t).*cos(u); y=sin(t).*cos(u); z=sin(u); surfl(0.2.*x+0.6,0.2.*y-2.9,0.2.*z+0.1); surfl(0.2.*x+0.6,0.2.*y+2.9,0.2.*z+0.1); surfl(0.2.*x+4.2,0.2.*y-2.9,0.2.*z+0.1); surfl(0.2.*x+4.2,0.2.*y+2.9,0.2.*z+0.1); surfl(0.2.*x+6.1,0.2.*y-2.6,0.2.*z+0.3); surfl(0.2.*x+6.1,0.2.*y+2.6,0.2.*z+0.3); % dessin de yeux [t,u]=meshgrid(a:(b-a)/60:b,c:(d-c)/60:d); x=cos(t).*cos(u); y=sin(t).*cos(u); z=sin(u); surfl(0.3.*x+7.3,0.3.*y+0.8,0.3.*z+0.5); surfl(0.3.*x+7.3,0.3.*y-0.8,0.3.*z+0.5); % dessin des antennes de la bouche a = 0; b = 0.2; c = 0; d = 2.*pi; R = 5; [r,t]=meshgrid(a:(b-a)/20:b,c:(d-c)/20:d); x = r.*cos(t); y = r.*sin(t); z = -5.*r+8.*R; surfl(z-31.3,x-0.3,y-0.2); surfl(z-31.3,x+0.3,y-0.2); shading interp colormap(bone) axis vis3d axis off set(gcf,'color',[0.95 .95 .95],'Position',[250 190 300 220]) [az,el] = view; for a = 10:10:350 view(az+a,el) drawnow end hold off