Find the intersection of two vectors

조회 수: 4 (최근 30일)
Mahsa
Mahsa 2013년 10월 9일
답변: Walter Roberson 2013년 10월 10일
I have two pairs of point and vector in 2d and I should find its intersection. for example: p0=[0,0] vector_p0=[0,1] and p1=[-10,37.3205] vector_p1=[0.5;-0.866]

답변 (1개)

Walter Roberson
Walter Roberson 2013년 10월 10일
So is that like
x0 = 0 + 0 * t
y0 = 0 + 1 * t
x1 = -10 + 0.5 * t
y1 = 37.3205 - 0.866 * t
and you want to find the t such that x0 = x1 and y0 = y1 ?
If so, then you will have two equations in one unknown, and it will not be generally possible to find the solution.
0 + 0 * t is 0, so comparing that to x1, 0 = -10 * t/2 so t = 20 (exactly). Substituting into y0, we get that y0 = 0 + 1 * 20 = 20, and bringing that across to y1, we get that 20 = 37.3205 - 0.866 * 20. That leads to the conflict 20 = 20.0005.
If we guess that 0.866 is intended to represent 13/15 then 20 = P + 13/15*20 results in the solution P = 112/3 which is 37.3333 to 4 decimal places, not 37.3205.

카테고리

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

Community Treasure Hunt

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

Start Hunting!

Translated by