I am having a small issue with the distance calculation of a point-to-line and I cannot find the mistake.
I have the line:
$$x + 2y + 3 = 0$$
And I am trying to compute its distance to point $(x_0, y_0) = (0,0)$. According to the well-known formula:
$$ d = \frac{\left|ax_0+by_0+c\right|}{\sqrt{a^2 + b^2}} = \frac{\left|3\right|}{\sqrt{5}} = 1.3416$$
Now, I try to compute the same distance on a different manner. The line intersects the $y$ axes at $p=(0, -1.5)$. I am trying to solve the following triangle (sorry for the cheap plotting):
The distance computed before should correspond to the length of the red segment (perpendicular to the line that goes through the desired point), which could also be computed as:
$$ d = 1.5 \cdot cos(30^{\circ}) = 1.299$$
Both results for the length of the red segment do not match. What am I doing wrong?
Thank you in advance!
Best Answer
The angles are wrong - instead of $30^0$ it should be $\arctan(0.5) = 26.56^0$