Computing endpoint coordinates of point P of a line of known length d that ends perpendicularly at the known mid-point coordinates of another line

Is there a simple formula that gives the coordinates of a point P, which is the endpoint of a line of length d that passes perpendicularly through the midpoint of another line? The distance d of the endpoint P from the midpoint m of the perpendicular line is known.

For instance, if the coordinates of the endpoints of the perpendicular line are $$(x_1,y_1)$$ and $$(x_2,y_2)$$, then it is easy to figure out the coordinates of the mid-point $$((x_1+x_2)/2, (y_1+y_2)/2)$$. See the figure for clarification.enter image description here

• – amd Apr 1 at 21:58
• Also effectively a duplicate of math.stackexchange.com/q/1748456/265466: once you have the midpoint, your problem reduces to this one. – amd Apr 1 at 21:59

• The slope of $$d$$ is given by $$m_d=\frac{x_1-x_2}{y_2-y_1}$$
• The midpoint $$M$$ of the segment has the coordinates $$M\bigg(\frac{x_1+x_2}{2} \mid \frac{y_1+y_2}{2}\bigg)$$
• If $$P$$ has the coordinates $$P(x_p\mid y_p)$$, then $$d^2=\big (\frac{x_1+x_2}{2}-x_p\big)^2+\big(\frac{y_1+y_2}{2}-y_p\big)$$
• What if $y_1=y_2$? – amd Apr 1 at 21:57
• If $y_1=y_2$ the problem is quite easy to solve: $P=(\frac{x_1+x_2}{2},y_1 \pm d)$. – Ertxiem Apr 1 at 22:12