A line draw between $(x_1,y_1)$ to $(x_2,y_2)$. I need to find the ending point in which the line is extended by $D$ distance(or length).
From the above image, $(x_1,y_1)$,$(x_2,y_2)$ and $D$ is known, I need to find $(x_3,y_3)$.
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It only takes a minute to sign up.
Sign up to join this communityWelcome to MSE. One way to express the location of $(x_3, y_3)$ is as $\langle x_2, y_2 \rangle + D \cdot \langle u, v \rangle $, where $\langle u, v\rangle$ is the unit vector pointing in the direction of $\langle x_2, y_2 \rangle - \langle x_1, y_1 \rangle$
Define the unit vector from $(x_1, y_1)$ to $(x_2, y_2)$ as follows
$ v = \dfrac{ (x_2 - x_1, y_2 - y_1) }{L}$
where $L = \sqrt{ (x_2 - x_1)^2 + (y_2 - y_1)^2 } $
Then
$(x_3, y_3) = (x_1, y_1) + (L+D) v $
or equivalently,
$(x_3, y_3) = (x_2, y_2) + D v $
The line through $(x_1, y_1)$ and $(x_1, y_2)$ can be written $y= \frac{y_2-y_1}{x_2-x_2}(x- x_2)+ y_2$.
The circle with center at $(x_2, y_2)$ and radius D can be written $(x-x_2)^2+ (y-y_2)^2= D^2$.
$(x_3, y_3)$, the endpoint of the line segment extended from $(x_2, y_2)$ by distance D is where that line and circle intersect so we must have $(x_3- x_2)^2+ (\frac{y_2-y_1}{x_2-x_2}(x_3- x_2))^2= D^2$.
Solve that quadratic equation for $x_3$ and then use the equation of the line to find $y_3$.
(That equation will have two roots. You want the one on the other side of $x_2$ from $x_1$.)