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
|
function dessin(obj,event)
m = getappdata(0,'formes'); % Récupération de la matrice m qui contient les formes
taille = size(m);[nbLignes nbColonnes]
nbLignes = taille(1,1);
cla;
for i = 1:nbLignes
if m(i,1) == 0
XCentre = 0;
YCentre = 0;
Rayon = m(i,5);
VThetaDeg = 0:1:360;
VTheta = VThetaDeg * pi / 180;
XCercle = XCentre + Rayon * cos(VTheta);
YCercle = YCentre + Rayon * sin(VTheta);
hold on;
plot(handles(2), XCercle, YCercle, 'color','black');
elseif m(i,1) == 1
alpha = 2 * pi / m(i,4);
r = m(i,5);
x = [];
y = [];
x1 = [];
y1 = [];
for j = 1:m(i,4)
xj = r * sin(j * alpha + (alpha/2) );
yj = r * cos(j * alpha + (alpha/2) );
if j == 1
x1 = [xj];
y1 = [yj];
end
x = [x;xj];
y = [y;yj];
hold on;
plot(handles(2), x, y);
end
x = [x;x1];
y = [y;y1];
hold on;
plot(handles(2), x, y);
end
end |
Partager