function [scaleZ1,teta1,scaleZ2,teta2]=DisplRadCirc(g1,displ13,g2,displ23)

scaleZ10=sqrt(g1.FEM.nodes(:,2).^2+g1.FEM.nodes(:,3).^2);
teta10=atan2(g1.FEM.nodes(:,3),g1.FEM.nodes(:,2));
scaleZ11=sqrt((g1.FEM.nodes(:,2)+displ13(:,1)).^2+(g1.FEM.nodes(:,3)+displ13(:,2)).^2);
teta11=atan2((g1.FEM.nodes(:,3)+displ13(:,2)),(g1.FEM.nodes(:,2)+displ13(:,1)));
scaleZ1=sqrt(displ13(:,1).^2+displ13(:,2).^2);
% teta1=-acos((scaleZ10-scaleZ11.*cos(teta11-teta10))./scaleZ1)
teta1=teta11-teta10;
teta1=unwrap(teta1);

y2=g2.FEM.nodes(:,3)-g2.params.origin(2);
scaleZ20=sqrt(g2.FEM.nodes(:,2).^2+y2.^2);
teta20=atan2(y2,g2.FEM.nodes(:,2));
scaleZ21=sqrt((g2.FEM.nodes(:,2)+displ23(:,1)).^2+(y2+displ23(:,2)).^2);
teta21=atan2((y2+displ23(:,2)),(g2.FEM.nodes(:,2)+displ23(:,1)));
scaleZ2=sqrt(displ23(:,1).^2+displ23(:,2).^2);
% teta2=acos((scaleZ20-scaleZ21.*cos(teta21-teta20))./scaleZ2)
teta2=teta21-teta20;
teta2=unwrap(teta2);

PlotDefoMesh_mod(g1.FEM.nodes(:,2:4),g1.FEM.elems(:,2:9),4/max(abs(scaleZ1)),...
    displ13,teta1,...
    g1.FEM.surffaces,g1.FEM.elfa);
c=colorbar;
c.Label.String='[rad]';
title('Spostamenti circonferenziali pignone')
% title('pignone')
PlotDefoMesh_mod(g2.FEM.nodes(:,2:4),g2.FEM.elems(:,2:9),4/max(abs(scaleZ1)),...
    displ23,teta2,...
    g2.FEM.surffaces,g2.FEM.elfa);
c=colorbar;
c.Label.String='[rad]';
title('Spostamenti circonferenziali ruota condotta')
% title('ruota condotta')


PlotDefoMesh_mod(g1.FEM.nodes(:,2:4),g1.FEM.elems(:,2:9),4/max(abs(scaleZ1)),...
    displ13,scaleZ1,...
    g1.FEM.surffaces,g1.FEM.elfa);
c=colorbar;
c.Label.String='[mm]';
title('Spostamenti radiali pignone')
PlotDefoMesh_mod(g2.FEM.nodes(:,2:4),g2.FEM.elems(:,2:9),4/max(abs(scaleZ1)),...
    displ23,scaleZ2,...
    g2.FEM.surffaces,g2.FEM.elfa)
c=colorbar;
c.Label.String='[mm]';
title('Spostamenti radiali ruota condotta')


PlotDefoMesh_mod2(102,g1.FEM.nodes(:,2:4),g1.FEM.elems(:,2:9),max(abs(scaleZ1)),...
    displ13,scaleZ1,...
    g1.FEM.surffaces,g1.FEM.elfa)
PlotDefoMesh_mod2(102,g2.FEM.nodes(:,2:4),g2.FEM.elems(:,2:9),max(abs(scaleZ1)),...
    displ23,scaleZ2,...
    g2.FEM.surffaces,g2.FEM.elfa)
c=colorbar;
c.Label.String='[mm]';
title('Spostamenti radiali accoppiamento')

PlotDefoMesh_mod2(100,g2.FEM.nodes(:,2:4),g2.FEM.elems(:,2:9),4/max(abs(scaleZ1)),...
    displ23,teta2,...
    g2.FEM.surffaces,g2.FEM.elfa);
PlotDefoMesh_mod2(100,g1.FEM.nodes(:,2:4),g1.FEM.elems(:,2:9),4/max(abs(scaleZ1)),...
    displ13,teta1,...
    g1.FEM.surffaces,g1.FEM.elfa);
c=colorbar;
c.Label.String='[rad]';
title('Spostamenti circonferenziali accoppiamento')
end
