I couldn't find this question asked for the 3D case; so here goes:
I have a circle given by the center $c=(x_c,y_c,z_c)$ and the normal $n=(x_n,y_n,z_n),||n||=1$.
Further, I have a point $p=(x_p,y_p,z_p)$ that is guaranteed to be in the same plane of the circle and also outside of the circle.
I am looking for a closed form for the two tangents from $p$ to the circle.
My idea is to get the formula for the circle from here Parametric Equation of a Circle in 3D Space?:
$\left(\matrix{x\\y\\z}\right)=c+r\cdot \cos(\theta)\cdot a+r\cdot \sin(\theta)\cdot b$
($a, b, r$ are known) and set it equal to the other required property:
$\left(\matrix{x-x_c\\y-y_c\\z-z_c}\right).\left(\matrix{x-x_p\\y-y_p\\z-z_p}\right)=0$
But I don't know where to go from there.
Thanks in advance!
From your last equation you could obtain $\theta$ (actually, you should find two solutions) and from that also the coordinates of the tangency points $t_1$ and $t_2$. But in practice this leads to complicated equations.
A simpler method could be the following: if $m=(p+c)/2$ is the midpoint of $pc$, subtract the cartesian equation of the sphere with center $m$ and radius $||m-p||$ from the equation of the sphere with center $c$ and radius $r$: the result is the equation of plane $\alpha$, perpendicular to line $pc$ and containing the tangency points.
The intersection of $\alpha$ with the plane of the circle, and with the sphere with center $c$ and radius $r$, will readily give the required tangency points.
EDIT.
We can simplify the equations by making a translation to make $c=(0,0,0)$. In that case the system of equations described above can be written as $$ \cases{ p\cdot t=r^2\\ n\cdot t=0\\ t\cdot t=r^2 } $$ where $t=(x,y,z)$ is a tangency point. To solve this, we can make use of the fact that $p$ and $n\times p$ are two orthogonal vectors in the plane of the circle. There exist then two real numbers $\alpha$ and $\beta$ such that $$ t=\alpha p+\beta(n\times p). $$ By substituting that into the equations one can readily find $\alpha=\rho^2$ and $\beta=\pm\rho\sqrt{1-\rho^2}$, where I set $\rho=r/||p||$. Finally, we can make the reverse translation and obtain the final formula: $$ t=c+\rho^2(p-c)\pm\rho\sqrt{1-\rho^2}\,n\times(p-c), \quad\hbox{with}\quad \rho={r\over||p-c||}. $$