Solution (source code)

= Solution

The signed displacement of the sphere centre from the plane is $g\cdot n-p$. Orthogonal projection gives the circle centre
$$
h=g+(p-g\cdot n)n.
$$
Pythagoras gives
$$
R=\sqrt{A^2-(p-g\cdot n)^2}.
$$
A real circle exists when $|p-g\cdot n|\leq A$: equality gives tangency and radius zero, while strict inequality gives a genuine circle.