Given is a point $A$, an angle $\alpha$ and a point $B$ (see picture). The two parallel lines go through $A$ and $B$ and have the angle $\alpha$. How is the distance between the two parallel lines calculated?
Follow-up-question: Is it possible to return a negative distance if the parallel line of $B$ is above the parallel line of $A$?


The distance between the parallel lines is just the perpendicular distance from $B$ to the line through $A$. If $A=(x_A,y_A)$, then the point-normal form of equation of the line through $A$ gives us $$(x-x_A)\sin\alpha-(y-y_A)\cos\alpha = 0.$$ The distance to $B=(x_B,y_B)$ is then given by a standard formula: $${\lvert(x_B-x_A)\sin\alpha-(y_B-y_A)\cos\alpha\rvert \over \sqrt{\sin^2\alpha+\cos^2\alpha}} = \lvert(x_B-x_A)\sin\alpha-(y_B-y_A)\cos\alpha\rvert.\tag{*}$$ This is essentially the length of the orthogonal projection of $B-A$ onto the unit normal vector $(\sin\alpha,-\cos\alpha)$ to the line.
If the line is not vertical, we can always arrange for the $y$-component of this normal vector to be negative so that it defines “down” relative to the line through $A$. If you drop the absolute value from (*), the sign of the resulting expression tells you in which half-plane $B$, and so also the line through $B$, lies relative to the line through $A$: if positive, it’s on the half-plane into which the normal points—“below” the line for our choice of normal; if negative, it’s in the other half-plane—“above” the line; if zero, $B$ lies on the line through $A$.