Solution (source code)

= Solution

For $ax+by+c=0$, substitute $y=0$ or $x=0$, respectively:
$$
\boxed{(x,0)=(-c/a,0)\quad(a\ne0),\qquad
(0,y)=(0,-c/b)\quad(b\ne0).}
$$
In terms of the original <coordinates>, these are
$$
\left(\frac{x_Ay_B-x_By_A}{y_B-y_A},0\right),\qquad
\left(0,\frac{x_Ay_B-x_By_A}{x_A-x_B}\right),
$$
with each expression used only when its denominator is nonzero. If $a=0$, the <straight line> is horizontal: it misses the horizontal axis unless $c=0$, in which case it is that entire axis. If $b=0$, it is vertical: it misses the vertical axis unless $c=0$, in which case it is that entire axis. A <straight line> through the origin has both finite intercepts equal to the origin whenever neither axis is coincident with it.