1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66
| % réservation de l'espace mémoire
n=5;
V = moviein(n);%% nombre d'images: n=5
%redimension (grossissement comme on veut "*") + recalage (prend le point min
%Pour l'objet1
[m11,m12,m13]= mini(X);
[m21,m22,m23]= mini(Y);
[m31,m32,m33]= mini(Z);
%Pour l'objet2
[m1,m2,m3]= mini(M);
for i=1:n
for j=1:length(X)
%%Objet1
x(j,1)=X(j,1)+X(j,1)*exp(i)*10^(-3)-(m11*exp(i)*10^(-3));
x(j,2)=X(j,2)+X(j,2)*exp(i)*10^(-3)-(m12*exp(i)*10^(-3));
x(j,3)=X(j,3)+X(j,3)*exp(i)*10^(-3)-(m13*exp(i)*10^(-3));
y(j,1)=Y(j,1)+Y(j,1)*exp(i)*10^(-3)-(m21*exp(i)*10^(-3));
y(j,2)=Y(j,2)+Y(j,2)*exp(i)*10^(-3)-(m22*exp(i)*10^(-3));
y(j,3)=Y(j,3)+Y(j,3)*exp(i)*10^(-3)-(m23*exp(i)*10^(-3));
z(j,1)=Z(j,1)+Z(j,1)*exp(i)*10^(-3)-(m31*exp(i)*10^(-3));
z(j,2)=Z(j,2)+Z(j,2)*exp(i)*10^(-3)-(m32*exp(i)*10^(-3));
z(j,3)=Z(j,3)+Z(j,3)*exp(i)*10^(-3)-(m33*exp(i)*10^(-3));
end
%surf/style- objet1
s = surf(x,y,z, ...
'LineStyle','none',...
'FaceColor','none',...
'Marker','.',...
'EdgeColor','red',...
'MarkerSize',3)
axis on;
daspect([1 1 1]);
l1 = light;
l2 = light;
lightangle(l1,70,-40);
lightangle(l2,-30,80);
hold on;
%objet2
X1=x1+x1*exp(i)*10^(-2)-(m1*exp(i)*10^(-2)); % m1=min x1
Y1=y1+y1*exp(i)*10^(-2)-(m2*exp(i)*10^(-2)); % m2=min y1
Z1=z1+z1*exp(i)*10^(-2)-(m3*exp(i)*10^(-2)); % m3=min z1
G = [X1,Y1,Z1];%nouvelle matrice
T1 = delaunay3(G(:,1),G(:,2),G(:,3));%algo delaunay
tetramesh(T1,G,'facecolor',[0 1 0]);%cancer reméché
title(['Temps = ',int2str(i)])% affiche le temps qui s'écoule
drawnow
V(:,i)=getframe(gcf); %capture de l'image
end
numtimes = 1; %nombre d'animations
fps = 1;%nb d'image par seconde
movie(gcf,V,numtimes,fps) %film |
Partager