Placing circles along a square spiral In this code golf challenge, you'll be computing the placement of circles of areas \$\pi, 2\pi, 3\pi, \dots\$ when greedily placed along integer points in a square spiral in such a way that no two overlap.
A square spiral is a sequence in \$\mathbb Z^2\$ that starts at \$(0,0)\$ and successively wraps around the origin. (Like Arnauld, you might find inspiration from this CGSE question.)
(0, 0) -&gt; (1, 0) -&gt; (1, 1) -&gt; (0, 1) -&gt; (-1, 1) -&gt; (-1, 0) -&gt; (-1, -1) -&gt; (0, -1) -&gt; (1, -1) -&gt; (2, -1) -&gt; (2, 0) -&gt; (2, 1) -&gt; (2, 2) -&gt; (1, 2) -&gt; (0, 2) -&gt; (-1, 2) -&gt; (-2, 2) -&gt; (-2, 1) -&gt; (-2, 0) -&gt; (-2, -1) -&gt; (-2, -2) -&gt; (-1, -2) -&gt; (0, -2) -&gt; (1, -2) -&gt; (2, -2) -&gt; (3, -2) -&gt; (3, -1) -&gt; (3, 0) -&gt; (3, 1) -&gt; (3, 2) -&gt; ...



In this challenge, you will start at the origin, walk around the spiral, and place circles with areas \$\pi, 2\pi, 3\pi\$, at integer points in a greedy fashion, as shown in the GIF below.
The first seven circles are:

a circle of area \$\pi\$ placed at \$(0,0)\$,
a circle of area \$2\pi\$ placed at \$(2,2)\$,
a circle of area \$3\pi\$ placed at \$(-2,2)\$,
a circle of area \$4\pi\$ placed at \$(3,-2)\$,
a circle of area \$5\pi\$ placed at \$(-3,-3)\$,
a circle of area \$6\pi\$ placed at \$(5,5)\$, and
a circle of area \$7\pi\$ placed at \$(0,6)\$.


Again, the circles are placed as soon as they fit. The second circle could not be placed at \$(1,0)\$, \$(1,1)\$, \$(0,1)\$, \$(-1,1)\$, \$(-1,0)\$, \$(-1, -1)\$, \$(0,-1)\$, \$(1, -1)\$, \$(2, -1)\$, \$(2, 0)\$, or \$(2, 1)\$ without overlapping with the first circle, but it could be—and is—placed at \$(2,2)\$.
Once we've placed &quot;all&quot; of the blue circles, we start over. In the second generation, we place &quot;red&quot; circles with areas \$\pi, 2\pi, 3\pi\$, in a greedy fashion:

Once we've placed all of the red circles from the second generation, we move onto yellow circles, cyan circles, magenta, dark green, purple, light green, orange, brown circles, and so on.

Challenge
Okay! That's a lot of setup! Here's your code-golf challenge:
Write a program that takes in two positive (alternatively, \$0\$-indexed) integers, g and k, and outputs the position of the circle of area \$k\pi\$ in the \$g\$-th generation.
When \$g=1\$, this corresponds to the blue circles; when \$g=2\$, this corresponds to the red circles; when \$g=3\$, the yellow circles, and so on.
Your program should be able to compute all of the values in the following table in practice, and it should be able to compute bigger values (without running into floating point errors) in principle.
Data table
 g |  k | position   | (color in GIFs; for reference only)
---+----+------------+------------------------------------
 1 |  1 | (0, 0)     | blue
 1 |  2 | (2, 2)     | blue
 1 |  3 | (-2, 2)    | blue
 1 | 50 | (36, -18)  | blue
 2 |  1 | (0, -4)    | red
 2 |  2 | (-3, 9)    | red
 2 | 14 | (-2, -59)  | red
 2 | 15 | (-66, 28)  | red
 3 |  1 | (-5, 2)    | yellow
 3 |  2 | (4, -10)   | yellow
 3 | 10 | (-58, 3)   | yellow
 8 |  1 | (-6, 10)   | orange
 8 |  2 | (16, 21)   | orange
 8 |  3 | (-27, -19) | orange
 9 |  1 | (-10, 6)   | orange
 9 |  2 | (-25, 4)   | orange
 9 |  3 | (17, -27)  | orange
JavaScript (ES7),  319  309 bytes
Expects (g)(k) and returns [x,y].
The formula for the spiral coordinates was inspired by this answer from Neil.

g=&gt;k=&gt;{a=[];p=[];r=[];H=Math.hypot;F=n=&gt;{while((j=p[n]=-~p[n],C=_=&gt;((i+2&gt;&gt;2)-i%2*j)*~-(i--&amp;2),x=C(i=(--j*4+1)**.5|0,j-=i*i&gt;&gt;2),y=C(),n)&amp;&amp;a.every(([N,X,Y])=&gt;~N+n|H(X,Y)&lt;2*H(x,y))&amp;&amp;!F(n-1,p[n]--)||a.some(([_,X,Y,R])=&gt;H(X-x,Y-y)&lt;R**.5+q**.5,q=-~r[n]));a.push([n,x,y,r[n]=q])};while(~~r[g-1]&lt;k)F(g-1);return[x,y]}

Try it online!
How?
One tricky point in the challenge is to figure out how many circles of generation \$n-1\$ must be processed before we can start generation \$n\$.
In this implementation, we don't attempt to put a new circle of generation \$n\$ at \$(x_0,y_0)\$ until there's at least one circle of generation \$n-1\$ at \$(x_1,y_1)\$ which is at least twice as far from the center of the spiral:
$$\sqrt{{x_1}^2+{y_1}^2}\ge2\times \sqrt{{x_0}^2+{y_0}^2}$$