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

x1 = 0:h:a;
nx1 = length(x1);
x2 = 0:h:b;
nx2 = length(x2);
N = nx1*nx2;
[X1,X2] = meshgrid(x1,x2);
P = [X1(:)';X2(:)'];

m = 2*(nx1-1)*(nx2-1);
T = zeros(3,m);
idx = 1;
for i=1:(length(x1)-1)
  for j=1:(length(x2)-1)
    I1 = (i-1)*nx2+j;
    I2 = I1+1;
    I3 = i*nx2+j;
    I4 = I3+1;
    T(:,idx+[0,1]) = [[I1;I3;I4] [I1;I4;I2]];
    idx = idx+2;
  end
end

ID1 = [1:nx2,(N-nx2+1):N];
ID2 = [1:nx2:N,nx2:nx2:N];
ID = union(ID1,ID2);
