[Math] Get tangent vector from point to sphere vector

geometryspheresvector-spaces

I have a sphere that has it's center at $A$ and lets say a radius of 1. Then I have a point $C$, some units away from the sphere in an arbitrary direction. I can easily calculate a vector, lets say $\vec{N}^{\,}$, that tells the direction from the point to the sphere. How can I now get a tangent directional vector at the intersection of $\vec{N}^{\,}$ with the sphere, $\vec{R}^{\,}$ that also points in a specific direction.

Let me demonstrate in 2D and then I can explain my difficulty with 3D
2d

What I want is R, I can calculate it in 2D because I can get the intersection point of $\vec{N}^{\,}$ in the circle and calculate the tangent of that point.

But in 3D I cannot do the same because the tangent would be a plane and not a line so there is no way I can calculate $\vec{R}^{\,}$

3D

Is it possible to get such a vector in 3D?

Best Answer

I figured it out, since the sphere is centered at the origin, the cross product between $\vec{N}^{\,}$ and $\vec{Z}^{\,}$ will result in $\vec{R}^{\,}$.