Radix exapansion and Heighway (twin) dragon

It turns out that we can express points in the complex plane as expansions in terms of powers of -1+i. Knuth, Gilbert, and others wrote about this quite a long time ago (1960s and 70s). This program is to illustrate this phenomena. You can do the same sort of thing for certain other complex bases. See e.g., papers by e.g., Ito, Tokyo J. Math, vol 12, No 2, 1989, and many others.
layout: portrait/landscape (change for wide enough screens)

Expansion (for last drawn point):
0=0
0=0
0=0

Spiral: Grid:

Map from integers to Gausian integers

In the figure, a square of side length 1 and centre at points of the form (a,b), with a,b integers, is coloured in if f(a,b) is less than the coefficients parameter, for a certain function f, described as follows. For a positive integer T, we can write T in a binary expansion,
T=a0 + a12 + a222 + a323 + ... + an2n
with the coefficients ai being either 0 or 1. This series ends after finitely many terms. So from a positive integer T, we get a sequence (a0, a1, a2, ..., an), where the number of terms, n, depends on T. E.g., 11=1+2+8 gives us the sequence (1,1,0,1)
Given any binary sequence, (a0, a1, a2, ..., an), we can construct a Gausian integer (wikipedia page)
S=a0 + a1w + a2w2 + a3w3 + ... + anwn
where w=-1+i (where i is the square root of -1; it doesn't matter whether we take +i or -i, except that the picture will flip about the x axis).
So, we can take any non negative integer T, write it in binary, and convert to a Gausian integer S, so we get a function F(T). This turns out to be a bijection. We can then map from Gausian integers to ordered pairs (a,b) of integer coordinates. We can define f((a,b)) to be inverse of this composition. E.g., f(-1,1)=1. If f(a,b)<=T, then we colour in the point (a,b).

Controls

The coefficients slider changes the maximum value of T for which the points are drawn, i.e, draw point (a+ib) if f(a,b)<=T. The colour slider changes how the point (a,b) is coloured. The strip at the left of the image indicates the colour scale. The point of the various colour schemes is to indicate various corresponding tilings of the plane.
The grid is grid of lines with an integer coordinate. The spiral passes through the powers of w=(-1+i), which form the basis of the expansion. The spiral line gives points on a line parameterised by f(t) = wt. When t is an integer, the point on the spiral will coincide with a Gausian integer. You can see an invariance under multiplication by w in the whole picture.