intmat1=[[1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0]
	[0 0 0 0 0 0 0 0 1 0 0 0 0 0 0 0]
	[-3 0 0 3 0 0 0 0 -2 0 0 -1 0 0 0 0]
	[2 0 0 -2 0 0 0 0 1 0 0 1 0 0 0 0]
	[0 0 0 0 1 0 0 0 0 0 0 0 0 0 0 0]
	[0 0 0 0 0 0 0 0 0 0 0 0 1 0 0 0]
	[0 0 0 0 -3 0 0 3 0 0 0 0 -2 0 0 -1]
	[0 0 0 0 2 0 0 -2 0 0 0 0 1 0 0 1]
	[-3 3 0 0 -2 -1 0 0 0 0 0 0 0 0 0 0]
	[0 0 0 0 0 0 0 0 -3 3 0 0 -2 -1 0 0]
	[9 -9 9 -9 6 3 -3 -6 6 -6 -3 3 4 2 1 2]
	[-6 6 -6 6 -4 -2 2 4 -3 3 3 -3 -2 -1 -1 -2]
	[2 -2 0 0 1 1 0 0 0 0 0 0 0 0 0 0]
	[0 0 0 0 0 0 0 0 2 -2 0 0 1 1 0 0]
	[-6 6 -6 6 -3 -3 3 3 -4 4 2 -2 -2 -2 -1 -1]
	[4 -4 4 -4 2 2 -2 -2 2 -2 -2 2 1 1 1 1]];

N=128;
lset=zeros(N,N); speed=zeros(N,N); dlx1=zeros(N,N); dly1=zeros(N,N);
nbxmbad=zeros(N,N); nbxpbad=zeros(N,N); nbymbad=zeros(N,N); nbypbad=zeros(N,N);
[xxm,yym]=meshgrid(1:N,1:N);
flag=0;
