function P = CinDir2R( Q,L )

 %-- Distiller --------------------------------------
  ang0 = Q(1); ang1 = Q(2); ang2 = Q(3);
  l0 = L(1); l1 = L(2); l2 = L(3);

 %-- Plano em rotaçao -------------------------------
  xp_e = 0.5*cos(pi+ang0);  xp_d = 0.5*cos(ang0);
  yp_e = 0.5*sin(pi+ang0);  yp_d = 0.5*sin(ang0);
 
 %-- Pe/Foot ----------------------------------------
  xf_e = l0*cos(pi+ang0);   xf_d = l0*cos(ang0);
  yf_e = l0*sin(pi+ang0);   yf_d = l0*sin(ang0);
 
 %-- Tornozelo/Ankle --------------------------------
  x0=0;
  y0=0;

 %-- Joelho/Knee ------------------------------------
  x1=l1*cos(ang0+ang1);
  y1=l1*sin(ang0+ang1);
 
 %-- Anca/Hip ---------------------------------------
  x2=l2*cos(ang0+ang1)+l2*cos(ang0+ang1+ang2);
  y2=l2*sin(ang0+ang1)+l2*sin(ang0+ang1+ang2);
 %---------------------------------------------------
 
 %---------------------------------------------------
  P = [ xp_e;yp_e;xp_d;yp_d; xf_e;yf_e;xf_d;yf_d; x0;y0; x1;y1; x2;y2 ];
 %------------------------------------------------end
