function qf = BallCoordIK( B,L )

%-- Vector comprimentos: L = [l0 l1 l2 l3 l4 lt_L lt_W lt_H] -------------------------
 l0 = L(1); l1 = L(2); l2 = L(3); l3 = L(4); lt_h = L(8);
%-- Vector coordendas da bola: B = [xb ; yb] -----------------------------------------
 xb = B(1); yb = B(2);
%-- Parametros de Denavit-Hartenberg -------------------------------------------------
 q1 = atan2(yb,xb);
 
 k1 = xb; k2 = -(l0+lt_h+l1)*cos(q1); k3 = l3*cos(q1);
 q2 = atan2(k1,k2)-atan2(sqrt(k1^2+k2^2-k3^2),k3);
%-----------------------------------------------------------------------------------end
 qf = [q1 ; q2];
 