ha, finally I solved this.
So stupid.
n + g is the grid id.
a quick distance check to any point (0 .. 1) multiplicated with the frequency/scaling factor gives me the desired results.