Distance from point to line using $x \sin \theta - y \cos\theta$ I am struggling to understand an equation given in an academic paper (in atmospheric sciences/geography) that I am reading. The paper defines a line, called the Clear Line, which is derived through linear regression of a number of points. They state that

the transformation that quantifies the perpendicular displacement of a point from this line with be given by: $d = x \sin \theta - y \cos \theta$, where $\theta$ is the slope angle of the line.

I understand this to mean that the given equation should tell me the perpendicular distance from the point to the line. I have two problems: I can't see how this works, and it gives me different answers to other formulae that I do understand.
The diagram below shows a point (A) and two lines, $y = x$ and $y = x + 6$. Obviously the distance from the point (the dotted line) should be longer for $y = x + 6$ than it should be for $y = x$, but the formula given in the paper gives the same result for both. Of course this is the case, as the formula takes into account three of the four variables involved (gradient of the line and x and y locations of the point, but not the y-intercept of the line).

So, I have two questions:


*

*Am I correct in stating that the formula given in the paper does not calculate the distance from the point to the line.

*Given that it doesn't do that - what does it do? I assume it does something relevant (either that or the paper is completely wrong!) - but I can't seem to work out what it does by using trigonometry, constructing various triangles, and trying to understand where the equation came from - but I can't work it out!. It does seem to produce an answer that is vageuly related to the direction (if we just look at lines of different gradients - ignoring the intercepts - it seems to give a result which is related to the distance from the line).
Any ideas would be much appreciated!
 A: Distance of a point $(x_0,y_0)$ from a line $ax+by+c=0$ is $|ax_0+by_0+c|/\sqrt{a^2+b^2}$. You can write the equation of a line as $x\sin(\theta)-y\cos(\theta)+d=0$ where $\theta$ is angle with $x$ axis and $d$ is signed distance of origin from the line. Then distance of the point $P_0=(x_0,y_0)$ from the line will be $D_0=|x_0\sin(\theta)-y_0\cos(\theta)+d|$.
Edit 1:
Suppose you have the line $y=x+6$ and you want to write it in angle $\theta$ format.
a) Write this equation by bringing all terms to one side, as in $x-y+6=0$, now comparing with our blueprint $ax+by+c=0$ we have $a=1,b=-1,c=6$.
b) Find angle $\theta$ , in $[0,180)$ range, so that $\sin \theta=a/\sqrt{a^2+b^2}$. Here $\sin \theta=1/\sqrt{1^2+1^2}=1/\sqrt 2$. A calculator could be used to get $\theta$ but in this case we know from geometry $\theta=45^\circ$. In general $\theta=\sin^{-1} (a/\sqrt{a^2+b^2})$. Here $\sin^{-1}$ is a function that is available on most programs as $asin$ or $arcsin$ or $inv\ sin$, etc.
c) To get the $d$ in $x\sin(\theta)-y\cos(\theta)+d=0$ simply use $d=c/\sqrt{a^2+b^2}$.
So to convert $x-y+6=0$ we divide the equation by $\sqrt{a^2+b^2}$, which is $\sqrt 2$ in our example, to get $1/\sqrt 2 \ x-1/\sqrt 2 \ y+6/\sqrt2=0$. Now comparing against $x\sin(\theta)-y\cos(\theta)+d=0$ we have $\sin \theta =1/\sqrt 2$, $\cos\theta=1/\sqrt 2$, and $d=6/\sqrt 2$. The meaning of $d$ here is the length of line segment  that starts from origin and ends perpendicular to the original line $y=x+6$. 
A: The equation in the paper correctly gives the distance between a point and a line, but only when the line goes through the origin.  For other lines the trick is to shift both the line and the point up or down the same amount until the line goes through the origin.  If the line intercepts the y axis at b the resulting equation is $d=x \sin(\theta)-(y-b)\cdot \cos(\theta), $ where $(x,y)$ is the point, $\theta$ is the angle the line makes with the $x$ axis, and $d$ is the distance between the point and the line.
