フィルターのクリア

Formula for finding point on a line given distance along a line.

3 ビュー (過去 30 日間)
Wai Han
Wai Han 2020 年 10 月 10 日
コメント済み: Wai Han 2020 年 10 月 18 日
Start point - (x0, y0)
End point - (x1, y1)
x = x0 +- c/sqrt(1+m^2)
This equation is not working for my case because I only need the middle point between the two, not the one away from the end point.
I want to find the point (xt,yt).
Can anyone guide me this?
I am asking this for the path finder (rapidly exploring random trees) method.
  2 件のコメント
Ameer Hamza
Ameer Hamza 2020 年 10 月 10 日
Can you explain more? What are c and m? Drawing an image and marking the points you want to find will be helpful.
Wai Han
Wai Han 2020 年 10 月 10 日
編集済み: Wai Han 2020 年 10 月 10 日
@Ammer Hamza, I've got this problem. Please help me with this Question.

サインインしてコメントする。

採用された回答

KSSV
KSSV 2020 年 10 月 10 日
P0 = rand(1,2) ;
P1 = rand(1,2) ;
% Normalize the line
v = P1-P0 ;
vunit = v/norm(v) ;
% Get a point from P0 at a distance t
t = 0.5 ;
Pt = P0+t*vunit ;
% Check, find the diatnce btween Pt and P0
d = sqrt(sum((Pt-P0).^2)) ;
% plot
plot([P0(1) P1(1)],[P0(2) P1(2)],'r')
hold on
plot(Pt(1),Pt(2),'*k')
  1 件のコメント
Wai Han
Wai Han 2020 年 10 月 18 日
Thank you so much! It helps me a lot.

サインインしてコメントする。

その他の回答 (0 件)

カテゴリ

Help Center および File ExchangeComputational Geometry についてさらに検索

製品


リリース

R2020b

Community Treasure Hunt

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

Start Hunting!

Translated by