//  calcule les fonctions d'interpolation sur les vrais elements
//
function init_trace_2D()

   global CONNEC COOR NUMER ADRESS UC Nelt Nno Npt NI;
   global XG PG Ng
   global F1 F2 F3 F4  Ca Cb

     [Nel,Nno]=size(CONNEC);

     F1 = zeros(Nel,4); F2 = zeros(Nel,4); F3 = zeros(Nel,4); 
     F4 = zeros(Nel,4);
     Ca = zeros(Nel,4); Cb = zeros(Nel,4);
     for i=1:Nel
      p = zeros(4,4);
      for j=1:4
        x = COOR(CONNEC(i,j),1);
        y = COOR(CONNEC(i,j),2);
        p(j,:) = [1 x y x*y ];
      end;
//
      a = zeros(4,4);
      for j=1:4
        f = zeros(4,1);
        f(j) = 1;
        a(:,j) = inv(p)*f;
      end;
//
      for j=1:4
         F1(i,j) = a(j,1); 
         F2(i,j) = a(j,2);
         F3(i,j) = a(j,3);
         F4(i,j) = a(j,4);
      end;
    end;

    for i=1:Nel
       for j=1:4
          x(j) = COOR(CONNEC(i,j),1);
          y(j) = COOR(CONNEC(i,j),2); 
       end;
       Ca(i,1) = (y(2)-y(1))/(x(2)-x(1));
       Ca(i,2) = (y(4)-y(3))/(x(4)-x(3));

       Ca(i,3) = (x(3)-x(2))/(y(3)-y(2));
       Ca(i,4) = (x(1)-x(4))/(y(1)-y(4));
       
       Cb(i,1) = (x(2)*y(1)-x(1)*y(2))/(x(2)-x(1));
       Cb(i,2) = (x(4)*y(3)-x(3)*y(4))/(x(4)-x(3));

       Cb(i,3) = (y(3)*x(2)-y(2)*x(3))/(y(3)-y(2));
       Cb(i,4) = (y(1)*x(4)-y(4)*x(1))/(y(1)-y(4));
     end;
       
        
endfunction
