S=[0 0 0 0 1	%1
   1 0 0 0 1	%2
   1 1 0 0 1	%3
   0 1 0 0 1	%4
   0 0 1 0 1	%5
   1 0 1 0 1	%6
   1 1 1 0 1	%7
   0 1 1 0 1	%8
   0 0 1 1 1	%9
   1 0 1 1 1	%10
   1 1 1 1 1	%11
   0 1 1 1 1	%12
   0 0 0 1 1	%13
   1 0 0 1 1	%14
   1 1 0 1 1	%15
   0 1 0 1 1]';	%16
   
A=[1 2;2 3;3 4;4 1;4 8;1 5;2 6;3 7;6 7;5 6;7 8;5 8;1 13;9 13;5 9;13 14;14 15;4 16;
   10 14;10 11;11 15;13 16;15 16;12 16;9 12;11 12; 9 10;6 10;8 12;7 11;2 14;3 15];
   
[li,co]=size(A);
h=plot3(0,0,0);
hold on
delete(h);
tobj=findobj('tag','xw');
uobj=findobj('tag','yw');
vobj=findobj('tag','zw');
wobj=findobj('tag','yw');
zobj=findobj('tag','xz');
xobj=findobj('tag','yz');
t=get(tobj,'value');
u=get(uobj,'value');
v=get(vobj,'value');
w=get(wobj,'value');
z=get(zobj,'value');
x=get(xobj,'value');
Rxw=[1    0      0    0 0 
     0 cos(t) -sin(t) 0 0
	 0 sin(t)  cos(t) 0 0
	 0    0      0    1 0
	 0    0      0    0 1];
Rxy=[1 0      0    0    0 
     0 1      0    0    0
	 0 0 cos(w) -sin(w) 0
	 0 0 sin(w)  cos(w) 0
	 0 0      0    0    1];
Rxz=[1 0      0   0      0 
     0 cos(z)  0 -sin(z) 0
	 0   0     1   0     0
	 0 sin(z)  0  cos(z) 0
	 0 0       0    0    1];
	
Ryw=[cos(u) 0 -sin(u) 0 0 
     0      1    0    0 0
	 sin(u) 0  cos(u) 0 0
	 0      0    0    1 0
	 0      0    0    0 1];
Ryz=[cos(x) 0 -sin(x) 0 0 
     0      1     0   0 0
	 0      0     1   0 0
	 sin(x) 0 0 cos(x)  0
	 0      0      0  0 1];
	
Rzw=[cos(v) -sin(v) 0 0 0 
     sin(v) cos(v)  0 0 0
	 0    0      1    0 0
	 0    0      0    1 0
	 0    0      0    0 1];


S=Rzw*Ryz*Ryw*Rxz*Rxy*Rxw*S;
P=[1 0 0 0 0
   0 1 0 0 0
   0 0 1 0 0
   0 0 0 1 0
   -.1 -.1 -.1 -.1 1];
S=P*S;
S(1,:)=S(1,:)./S(5,:);
S(2,:)=S(2,:)./S(5,:);
S(3,:)=S(3,:)./S(5,:);
S(4,:)=S(4,:)./S(5,:);
for i=1:li
	plot3([S(1,A(i,1)) S(1,A(i,2))],[S(2,A(i,1)) S(2,A(i,2))],[S(3,A(i,1)) S(3,A(i,2))],'linewidth',2)
end

axis equal
axis off
hold off

	
