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

조회 수: 2 (최근 30일)
bh dhouha
bh dhouha 2015년 5월 5일
댓글: bh dhouha 2015년 5월 5일
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

채택된 답변

James Tursa
James Tursa 2015년 5월 5일
de = e * (A - B) / norm(A - B);
D = B + de:
C = B - de;

추가 답변 (1개)

Image Analyst
Image Analyst 2015년 5월 5일
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
bh dhouha
bh dhouha 2015년 5월 5일
I know but i'm working on complicated things so sometimes i forget about details like this. Thanks anyway.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Computational Geometry에 대해 자세히 알아보기

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by