[Math] Find a equidistant point between two intersecting lines

geometry

I want to draw a straight dashed line segment given an intersection point between two lines segments. I am wondering, what is the best way to do this since I don't really have a second point to draw this line segment?

What I have done so far is calculate the intersection point of the two line segments.

So now I have one point, my question is how do I get the second point or what should I set the second point to be if I want the line to be straight from the intersection point?

So, I was thinking, I want to find an equidistant point between two intersecting lines such that that point is not the intersecting point of those two lines.

Image drawn is not exact or to scale but something like below:

enter image description here

How can I find the equidistant point? What's the formula for it? How do I derive the formula?

EDIT: I need a way to do this algebraically because I want to translate this into code.

Best Answer

Let $x_0$ be the intersection point of two lines $g$ and $h$, given by \begin{align*} g(t)=x_0+tv,\qquad h(t)=x_0+tw, \end{align*} where $v$ is a vector pointing along $g$ and $w$ is a vector pointing along $h$. Then the points which have the same distance to $g$ and $h$ lie on the lines given by \begin{align*} x_0+t\left(\frac{v}{|v|}\pm\frac{w}{|w|}\right). \end{align*}

Related Question