function z=L(i,tri,xy)
%
% Return triangle coordinates of points xy .
% i     Index of vertex (1,2,3)
% tri   Triangle   - a 2 x 3 matrix, each column is vertex point
% xy    [xrow;yrow] - points of evaluation
% HA Apr 1999

%% cyclic indices
 j=mod(i+1,3);k=mod(i+2,3);
 if j==0, j=3; end; 
 if k==0, k=3; end;

 [two,n]=size(xy);
 z=zeros(1,n);
     for ind=1:n,
       z(ind)=det([1 1 1;[xy(:,ind),tri(:,j),tri(:,k)]]);
       z(ind)=z(ind)/det([1,1,1;tri]);
       end;
         

