I am trying to explain all in detail and I hope that I will not be too boring. We first find the centers of the squares of the two square grids. If the length of their sides is equal to one, then the centers of the first grid are at the coordinates

x1(i1,j1)=(i1+j1+a)/sqrt(2) and y1(i1,j1) = (i1-j1+b)/sqrt(2) ,

where a and b are constants and i1 and j1 are integer variables. This grid is oriented diagonally. The second grid is parallel to the x- and y-axis and thus trivially

x2(i2,j2) = i2 and y2(i2,j2) = j2 .

Note that the constants a and b shift around the first grid, which results in different parts of the same tiling.

Where do we now find two squares forming an 8-pointed star ? Look at a this picture. Clearly, the centers of the squares have to be close enough to each other. Thus we need their difference

dx = abs(x1-x2) and dy = abs(y1-y2) ,

where the sign is not important and we use the absolute value. The point (dx,dy) then has to be inside a regular octagon.

The left corner of the diagonal square is outside the other square if

dx < sqrt(0.5)-0.5

and similarly the lower corner is outside if

dy < sqrt(0.5)-0.5 .

Finally the lower left corner of the parallel square is outside of the diagonal square if

(dx+dy)/L < 1 - sqrt(0.5) .

We have a 8-pointed star if these three conditions are fulfilled. Then we get a point (x,y) of the tiling, which is a corner of several tiles. We use simply the midpoint between the centers

x = (x1+x2)/2 and y = (y1+y2)/2 ,

This is easy to program. Actually I am using *processing* because it has a good library for making graphics and animation. Processing is a powerful extension of java and it can be downloaded free from processing.org. Have a look at it !

Now we use the integers variables (i1, j1, i2, j2) all together. They give a cubic lattice in 4-dimensional space with points P of coordinates

p_x=i1/sqrt(2)+j1/sqrt(2)+i2 , p_y=i1/sqrt(2)-j1/sqrt(2)+j2 , p_z=i1/sqrt(2)+j1/sqrt(2)-i2 , p_w=i1/sqrt(2)-j1/sqrt(2)-j2 .

The three conditions from above applying to dx=p_z and dy=p_w select just some of these points. Each of them gives a point of the tiling with

x=p_x/2 , y=p_y/2 ,

which is essentially a projection from four-dimensional space into the two-dimensional plane. Thus this simple way to obtain a quasiperiodic Amman-Beenker tiling is the same as the projection method, but it is more easy to see what we do.

We get other tilings if we use squares of a different size. If the length of their sides is equal to L, then the conditions are

dx/L < sqrt(0.5)-0.5 , dy/L < sqrt(0.5)-0.5

and

(dx+dy)/L < 1 - sqrt(0.5) .

Values of L=sqrt(2) and L=sqrt(0.5) are particularly interesting.