
function good_lattice

n=5;

g1=[1/2 1/2];
g2=[0 1];

z=good_lattice_builder(g1,g2,n);

size(z)

plot(z(:,1),z(:,2),'ko','MarkerEdgeColor','k',...
                       'MarkerFaceColor','g',...
                       'MarkerSize',10)


function z=good_lattice_builder(g1,g2,n)

n_top=1000*n;

v=(-n_top+1:n_top-1)/n;

[X,Y]=meshgrid(v);
Xv=X(:); Yv=Y(:);

z1=[Xv*g1(:,1) Xv*g1(:,2)];
z2=[Yv*g2(:,1) Yv*g2(:,2)];

z=z1+z2;

iok=find(z(:,1) >= 0 & z(:,1) <= 1 & z(:,2) >= 0 & z(:,2) <= 1);

z=z(iok,:);

