Line segment equation in polar coordinates I have a line segment given by two points $A$ and $B$. $$A+u(B-A), u\in[0,1]$$
when doing calculations with this segment, it would be advantageous to have it written in polar coordinates around some point $S$. More specifically, in the form $$r=f(\phi)$$
I could brute force this expression but the result starts getting ugly, fast. Is there some insight I can use that would give me a simpler definition of $f$ using $A$, $B$ and $S$?
 A: Let's assume that points $A$ and $B$ are $(x_1,y_1)$ and $(x_2,y_2)$ in Cartesian coordinates and $(r_1,\theta_1)$ and $(r_2,\theta_2)$ in polar coordinates.
Then the direction angle of the line segment is given by
$$\theta_0=\begin{cases}
\tan^{-1}\left(\frac{y2-y1}{x2-x1}\right),  & x_1\ne x_2 \\
\frac{\pi}2, & x_1=x_2
\end{cases}
$$
And the signed distance from the origin to the line containing points $A$ and $B$ is
$$d_0=r_1\sin(\theta_1-\theta_0)=r_2\sin(\theta_2-\theta_0)$$
(Use either formula for $d_0$: you get the same result.) If $d_0\ne 0$ then the line containing points $A$ and $B$ does not pass through the origin, and the polar equation of that line is

$$r=\frac{d_0}{\sin(\theta-\theta_0)}$$

and to get only the segment on the line just require that $\theta$ is between $\theta_1$ and $\theta_2$.
If $d_0=0$ then the line containing points $A$ and $B$ does pass through the origin, and thus $r$ is not a function of $\theta$ and another kind of polar equation will be required to specify the line, such as $\theta=\theta_1$ with $r$ limited to be between $r_1$ and $r_2$.
Note that the "distance" $d_0$ may be negative. If that is not desired, replace $d_0$ with $-d_0$ and $\theta_0$ with $\theta_0+\pi$ or $\theta_0-\pi$.
This diagram explains much of those formulas.

