I'm looking for a line equation passes through $2$ points in a $3$-dimensional space, and use it to determine the intersection between sphere and line.
Any help would be appreciated
$\endgroup$ 71 Answer
$\begingroup$With points $A(x_0,y_0,z_0)$ and $B(x_1,y_1,z_1)$, the canonical equation of a line that passes through these points is$$\dfrac{x-x_0}{x_1-x_0}=\dfrac{y-y_0}{y_1-y_0}=\dfrac{z-z_0}{z_1-z_0}$$One may take this equal to parameter $t\in\mathbb{R}$ to use the parametric equation of that line, which is$$ \begin{cases} x=(x_1-x_0)t+x_0,\\ y=(y_1-y_0)t+y_0,\\ z=(z_1-z_0)t+z_0. \end{cases} $$
$\endgroup$ 7