Notes:Grid iteration
From Maths
See Modulo operator for a definition of Mod(a,b)
2D grid

Notice the 21st point is back at the origin and the sequence repeats. Direct link
- Mixx(k,m,n):=Floor(Mod(Mod(k,mn),m))
- Mixy(k,m,n):=Mod(k,mn)−Mod(Mod(k,mn),m)m
Then
- Points of the form:
- (Mixx(k,m,n),Mixy(k,m,n))span an m×n grid, for k from 0 to mn−1
- (Mixx(k,m,n),Mixy(k,m,n))
3D grid
Suppose we have an ℓ×m×n grid,