function uBar=computeUbar(theGeoTransfo,l, u)
if theGeoTransfo=="linear"
        uBar=computeUbar_Linear(l,u);
elseif theGeoTransfo=="corotational"
        uBar=computeUbar_Corotational(l,u);
end
end


function uBar=computeUbar_Linear(l,u)
L = [
    -1, 0, 0, 1, 0, 0;
    0, 1/l, 1, 0, -1/l, 0;
    0, 1/l, 0, 0, -1/l, 1
];

uBar = L * u;
end


function uBar=computeUbar_Corotational(l,u)
DeltaUx = u(4) - u(1);
DeltaUy = u(5) - u(2);

ln = sqrt((l + DeltaUx)^2 + DeltaUy^2);
beta = atan(DeltaUy / (l + DeltaUx));

u1Bar = ln - l;
u2Bar = u(3) - beta;
u3Bar = u(6) - beta;
uBar = [u1Bar, u2Bar, u3Bar]';
end