% vazby

function R=vazby(z,q);

global b1 beta1 b2 beta2 b3 beta3 b4 beta4 b5 beta5 b6 beta6 b7 beta7 b8 beta8 b9 beta9 delta alfa gama b10 b11 b12 b13 b14 b15 b16 b17 b18 beta10 beta11 beta12 beta13 beta14 beta15 beta16 beta17 beta18 beta19

beta4=q(1);
beta7=q(2);

b1=z(1);
b2=z(2);
beta3=z(3);
beta6=z(4);
 beta10=z(5);
    beta11=z(6);
    beta12=z(7);
    beta16=z(8);

    beta5=beta3-delta;
    beta13=beta12-pi/2;
    beta14=beta3-gama;
    beta15=beta10+alfa;
    beta19=beta4-pi;
    
    
R=[b1*cos(beta1)+b2*cos(beta2)+b3*cos(beta3)+b4*cos(beta4)
   b1*sin(beta1)+b2*sin(beta2)+b3*sin(beta3)+b4*sin(beta4)
   b1*cos(beta1)+b2*cos(beta2)+b3*cos(beta3)+b5*cos(beta5)+b6*cos(beta6)+b7*cos(beta7)+b8*cos(beta8)+b9*cos(beta9)
   b1*sin(beta1)+b2*sin(beta2)+b3*sin(beta3)+b5*sin(beta5)+b6*sin(beta6)+b7*sin(beta7)+b8*sin(beta8)+b9*sin(beta9)
   b10*cos(beta10)+b11*cos(beta11)+b12*cos(beta12)+b13*cos(beta13)+b14*cos(beta14)
   b10*sin(beta10)+b11*sin(beta11)+b12*sin(beta12)+b13*sin(beta13)+b14*sin(beta14)
   b15*cos(beta15)+b16*cos(beta16)+b17*cos(beta17)+b18*cos(beta18)+b4*cos(beta19)
   b15*sin(beta15)+b16*sin(beta16)+b17*sin(beta17)+b18*sin(beta18)+b4*sin(beta19)];
