Considering the following situation:
The red dot is located at $(0,0)$ and the blue dot is at $(0,-2)$. A black line is crossing the red dot and is rotated at $\alpha = 45°$ relative to the red dot. With this information, how can I find the length of the yellow dashed line?
My first intuition is to calculate the distance $d$ between the two dots using:
$$d = \sqrt{(x_2 - x_1)^2 + (y_2 - y_1)^2}$$
The next step should be to calculate the distance between red dot and the point where the black line and yellow dashed line cross. But I can't seem to find how to do that, and even then, I am not sure of what to do next.
The problem gets worse since the methodology to find the distance of the yellow dashed line should work for different cases in which the blue dot can be located somewhere else.
For example, the following image has the situation in which the black line is still rotated at $\alpha = 45°$, the red dot is still at $(0,0)$ but the blue dot is located at $(-1,-2)$
The ultimate goal is to find a methodology that enables calculating the length of the yellow dashed line for any location of the blue dot but also any degree of rotation of the black line knowing that the red dot will always be at $(0,0)$. An example of such situation is shown on the picture under:
Here the red dot is still at $(0,0)$, the blue dot is at $(-2,-2)$ but the black line is rotated by $\alpha = 60°$ relative to the red dot.
Is it even possible to achieve this?


