function RD_display_cells_2D(cx,cy,cd,max_d,a)
%

[nr,nc] = size(cx);
clf
subplot(1,2,1);
hold on
axis equal
xlabel('X');
ylabel('Y');
for r = 1:nr
    for c = 1:nc
        x = cx(r,c);
        y = cy(r,c);
        plot(x,y,'ro');
    end
end
for c1 = 1:nr*nc-1
    [x1,y1] = RD_index2coords(c1,nr);
    for c2 = c1+1:nr*nc
        if cd(c1,c2)<max_d
            [x2,y2] = RD_index2coords(c2,nr);
            plot([cx(x1,y1),cx(x2,y2)],[cy(x1,y1),cy(x2,y2)]);
        end
    end
end

subplot(1,2,2);
surf(a);
axis equal
xlabel('X');
ylabel('Y');
