I have a point $(x_1, y_1)$, distance $d$ and a slope $m$ of line $l$.

Now I wanna find another point $(x_2, y_2)$ that's $d$ distance away from $(x_1, y_1)$.

Point $(x_1, y_1), (x_2, y_2)$ are both on the line $l$.

I found some similar questions but I didn't understand it, and none of them worked with the line slope Finding a point along a line a certain distance away from another point!

  • $\begingroup$ The post you are pointing at does give the solution ! $\endgroup$ – Yves Daoust Jun 8 '18 at 10:15
  • $\begingroup$ @YvesDaoust Nah not really, it works with start point and end point not with the slope tho. $\endgroup$ – Basma Ashour Jun 8 '18 at 10:18
  • $\begingroup$ Did you read the OP ? The formula with the slope is given. $\endgroup$ – Yves Daoust Jun 8 '18 at 10:38

Slope $m$ means that $\frac{y_2-y_1}{x_2-x_1}=m$. This gives You one equation. Another equation comes from $(y_2-y_1)^2+(x_2-x_1)^2=d^2$. Two equations for two variables - You only have to solve the system. It is not very easy in general form, but if $m$ and $d$ are given as numbers it's simple. You have from the first equation: $y_2=y_1+m(x_2-x_1)$, You can insert this in the second one. The result is $(m^2+1)(x_2-x_1)^2=d^2$. From here You can find $x_2$ and then $y_2$.

  • $\begingroup$ Thank you so much for your help ^^ $\endgroup$ – Basma Ashour Jun 8 '18 at 9:57

One (possibly not the simplest) way is as follows:

Write parametric equations for your line $\ell$: $$ x=x_1+lt,\qquad y=y_1+mt $$ where $(l,m)$ is a vector parallel to $\ell$ (to find it, just take any point $(\bar x,\bar y)$ on $\ell$ and let $l=\bar x-x_1$, $m=\bar y-y_1$).

Then renormalize $(l,m)$ so that $l^2+m^2=1$.

Done that, the points you are looking for are those corresponding to the value of the parameter $t=\pm d$.

  • $\begingroup$ Thank you so much :") $\endgroup$ – Basma Ashour Jun 8 '18 at 9:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.