function X2S=calcszp(X);
Lref=317.1; % arm lenght mm
tethainc=48.5; % inclination angle
Sliderheight=Lref*sind(tethainc);


Xtip=X(:,1);
Ytip=X(:,2);
Ztip=X(:,3);

XE =[68.0000         0         0
  -34.0000  58.8750        0
  -34.0000  -58.8750         0];


XS =[305.9469        0  Sliderheight
 -152.9734  264.9578  Sliderheight
 -152.9734 -264.9578  Sliderheight];


X2S(:,1:3)=[sqrt(Lref*Lref-((Xtip+XE(1,1)-XS(1,1)).^2+(Ytip+XE(1,2)-XS(1,2)).^2))+Ztip-Sliderheight sqrt(Lref*Lref-((Xtip+XE(2,1)-XS(2,1)).^2+(Ytip+XE(2,2)-XS(2,2)).^2))+Ztip-Sliderheight sqrt(Lref*Lref-((Xtip+XE(3,1)-XS(3,1)).^2+(Ytip+XE(3,2)-XS(3,2)).^2))+Ztip-Sliderheight];