function [P,T,ID,IN] = diskretizujObdelnik(a,b,h)

m1 = ceil(a/h);
n1 = m1+1;
x1 = linspace(0,a,n1);

m2 = ceil(b/h);
n2 = m2+1;
x2 = linspace(0,b,n2);

[X1,X2] = meshgrid(x1,x2);
P = [X1(:)';X2(:)'];
n = n1*n2;

ID = n-n2+1:n;

IN = [ [1:n2-1;2:n2] , [n2*[1:n1-1];n2*[2:n1]] , [n2*[n1-1:-1:1]+1;n2*[n1-2:-1:0]+1] ];

m = 2*m1*m2;
T = zeros(3,m);
idx = 1;
for i=1:m1
    for j=1:m2
        T(:,[idx:idx+1]) = [ [(i-1)*n2+j;i*n2+j;i*n2+j+1] , [(i-1)*n2+j;i*n2+j+1;(i-1)*n2+j+1] ];
        idx = idx+2;
    end
end

