# How to compute 'polar form' of a line given two points in cartesian coordinate system?

I'm stuck at the following problem I'd like to solve and first and foremost to comprehend:

Given two points $p_1, p_2 \in \mathbb{R}^{2}$ how can the equation of a line in polar form $\delta = x \cdot \cos(\alpha) + y\cdot \sin(\alpha)$ be computed? I currently went the path of computing the slope-intercept form $y = mx+b$ and then converting it to the mentioned polar form. However: is there a way of computing directly the polar given two points without computing the slope and intercept first?

Thank you in advance for any hints and with best regards

• Easy: divide the slope-intercept form by $\sqrt{1+m^2}$. – Aretino Jan 21 '18 at 12:02

If you have two points $(x_1,y_1)$ and $(x_2,y_2)$, you have to solve the following system of equations
$$\begin{cases}\delta = x_1\cos \alpha + y_1 \sin\alpha & ,\\ \delta = x_2\cos \alpha + y_2 \sin\alpha & .\\ \end{cases}$$
$$\cot\alpha=-\frac{y_2-y_1}{x_2-x_1}$$
Once you have $\alpha$ you can substitute back into one of the previous previous equations to find $\delta$.