I was asked to draw a cube and make it rotate around a given axis and to make a translation of it away from origo. Then rotate it again for a given a axis.
My code so far:
H=[0 0.3 0 0.3 0 0.3 0 0.3; 0 0 0.3 0.3 0 0 0.3 0.3; 0 0 0 0 0.3 0.3 0.3 0.3];
S=[1 2 4 3; 1 2 6 5; 1 3 7 5; 3 4 8 7; 2 4 8 6; 5 6 8 7];
figure(1), clf, hold on
for i=1:size(S,1)
Si=S(i,:); fill3(H(1,Si),H(2,Si),H(3,Si),'g','facealpha',0.6)
end
axis equal, axis on, hold off, view(20,10)
Best Answer