MATLAB Answers

0

How to translate a point on a line by a distance "e" ?

Asked by bh dhouha on 5 May 2015
Latest activity Commented on by bh dhouha on 5 May 2015
I have the line given by the points A and B . The line is in the form [a b c] where the equation is ax+by+c=0. I would like to know the coordinates of the points C and D (figure) which are on the same line but distant of "e" from the point B. I found some functions like "translation" etc but they work with matrices and are too complicated. I just would like to give the parameters of the line (a b c), the points A and B, distance e and get the coordinates of C and D as result. Thanks

  0 Comments

Sign in to comment.

2 Answers

Answer by James Tursa
on 5 May 2015
 Accepted Answer

de = e * (A - B) / norm(A - B);
D = B + de:
C = B - de;

  1 Comment

Sign in to comment.


Answer by Image Analyst
on 5 May 2015

This is just simple high school trig/algebra. You know the slope of the line, -a/b, so you know the angle, and so you can find the new x and y values of C and D with sin and cos and the value of e.

  1 Comment

I know but i'm working on complicated things so sometimes i forget about details like this. Thanks anyway.

Sign in to comment.