✔ decimal values allowed (e.g. 1.5, -0.75, 3.0)
Sphere equation (center \((h,k,l)\), radius \(r\)):
\[(x - h)^2 + (y - k)^2 + (z - l)^2 = r^2\]Line parametric form (point \((x_0,y_0,z_0)\), direction \((a,b,c)\)):
\[x = x_0 + a t,\quad y = y_0 + b t,\quad z = z_0 + c t\]Substitution yields a quadratic in \(t\):
\[(x_0 + a t - h)^2 + (y_0 + b t - k)^2 + (z_0 + c t - l)^2 = r^2\]After expansion:
\[ \underbrace{(a^2+b^2+c^2)}_{A}\;t^2 \;+\; \underbrace{2\big[a(x_0-h)+b(y_0-k)+c(z_0-l)\big]}_{B}t \;+\; \underbrace{(x_0-h)^2+(y_0-k)^2+(z_0-l)^2 - r^2}_{C} = 0 \]Discriminant \(\Delta = B^2 - 4AC\) determines the type of intersection:
Then \(t = \frac{-B \pm \sqrt{\Delta}}{2A}\) and plug back into line equations.