[alogo] Spiral tiling

Algorithm to place (tile) M parallelograms in a spiral-like way around the first which serves as prototype for the tiling.
0) M = 1, corresponds to the prototype, placed with its gravity center at (0,0). x = horizontal translation,
y = vertical translation, parallel and equal to the sides of the prototype tile.
1) M > 1. Starts the algorithm by determining the smallest n=2i+1, such that n^2 >= M.
2) if n^2 == M, place the M-th tile (with its gravity center) at (i*x, i*y).
3) if n^2 > M, then M1 = n^2-M-1, n1 = n-1, q = M1/n1 and r = M1 % n1 determine the place of the
M-th tile as follows:
4) q takes any one of the values 0, 1, 2, 3, corresponding to the sides [upper], [left], [bottom], [right].
5) Starting with the tile at ((i-1)*x, i*y) we place counterclockwise the tiles in blocs of n1 tiles.
6) q = 0, X = (i-1-r)*x, Y = i*y ,
7) q = 1, X = - i*x, Y = (i-1-r)*y,
8) q =2, X = (r+1-i)*x , Y = -i*y,
9) q = 3, X = i*x, Y = (r+1-i)*y.

[0_0] [0_1]
[1_0] [1_1]


The previous algorithm finds the place of the M-th tile, in a tiling of the plane, which proceeds in a spiral-like construction. This algorithm is used in the User-Tool script [Tiling_Spiral.txt].


Produced with EucliDraw©