I am programming a game and i can't find out the formula to spawn villages for newly created users.
This is how i want it to be. I want it to have a formula, where i give ID and it returns x, y coordinates. Its like the Nautilus shell spiral in x/y coordinates. I dont know how to explain, just giving an example.
Please in an easy-to-read way where i could make the formula with javascript.
ID x y
1 15 15
2 20 15
3 25 15
4 25 20
5 25 25
6 20 25
7 15 25
8 10 25
9 10 20
10 10 15
11 10 10
12 15 10
13 20 10
14 25 10
15 30 10
16 30 15
17 30 20
Parametric equations of a ''logarithmic spiral'' (classical name for the nautile shell).
$$\cases{x=0.1*exp(a*t)*cos(t)\\y=0.1*exp(a*t)*sin(t)}$$
with, for example $a=0.2$, for $t=0...(8*\pi)$ with a small step for $t$.
In this way you get 4 turns (4 is the number of times one take a 2\pi turn); take $(10*\pi)$ if you want one more turn, etc.