function [V,K] = kolokacniMatice1Vrstvy2dLaplace(P,E,radKvadratury)

load GaussQuadratureForLineSegments.mat

w = weights{radKvadratury};
ksi = points{radKvadratury};

n = size(E,2);
V = zeros(n,n);
for i=1:n
    PEi = P(:,E(:,i));
    Pi = (PEi(:,1)+PEi(:,2))/2;
    for j=1:n
        PEj = P(:,E(:,j));
        aj = PEj(:,1);
        bj = PEj(:,2);
        Sj = norm(bj-aj);
        if i==j
            V(i,i) = -(Sj/2/pi) * ( -1 + log(Sj/2) );
        else
                    Log = log(sqrt( (Pi(1)-aj(1)*(1-ksi)-bj(1)*ksi).^2 + (Pi(2)-aj(2)*(1-ksi)-bj(2)*ksi).^2 ));
                    V(i,j) = -(Sj/2/pi) * w * Log';
%             F = log( (Pi(1)-aj(1)-ksi*(bj(1)-aj(1))).^2 + (Pi(2)-aj(2)-ksi*(bj(2)-aj(2))).^2 );
%             V(i,j) = -0.5*Sj/(2/pi) * (w*F');
        end
    end
end
