% Plotting function for the circle packing problem. % draw_circle(x,D,iter) plots circles of diameter D at positions % given by the columns of x, and displays the iteration number on the % plot title. function [] = draw_circle_packing(x, D, iter) R = D/2; N = size(x,2); for i = 1 : N circle(x(:,i), R, 100, '-'); hold on; title(sprintf('iteration %d', iter)) end axis equal xlim([-R 1+R]); ylim([-R 1+R]); axis off; rectangle('Position', [0 0 1 1], 'LineStyle', '--'); saveas(gcf, 'packing.eps');