How can I find a intersection of four ponits?

1 view (last 30 days)
I know
A(n)=[x(n),y(n)],
A(n+1)=[x(n+1),y(n+1)]
A(m)=[x(m),y(m)],
A(m+1)=[x(m+1),y(m+1)]
I want to find a intersection point of Line A(n)-A(n+1) and A(m)-A(m+1) The x-coordinate of point(x,y) between x(n), x(n+1), x(m),and x(m+1) The y-coordinate of point(x,y) between y(n), y(n+1), y(m),and y(m+1)
  2 Comments
Walter Roberson
Walter Roberson on 18 Nov 2017
Are you sure that the last two knowns are both A(m)? Perhaps the last one is to be A(m+1) ?

Sign in to comment.

Answers (2)

David Goodmanson
David Goodmanson on 18 Nov 2017
Edited: David Goodmanson on 18 Nov 2017
Hello Yoon, lots of possible expressions for this. Here is one that is pretty symmetric in the points. Let
a = [x(n),y(n)]'
b = [x(n+1),y(n+1)]'
c = [x(m),y(m)]'
d = [x(m+1),y(m+1)]'
so, four column vectors. then
M = [b-a,d-c]
p = (1/4)*(a+b+c+d + M*[1 0;0 -1]*(M\(c+d-a-b)))

Roger Stafford
Roger Stafford on 18 Nov 2017
If A = [x1;y1] and B = [x2;y2] are coordinates of two points as column vectors on one of the lines with C = [x3;y3] and D = [x4;y4] as column vectors for two points on the other line, then the point P = [x;y] of the lines' intersection is:
TS = [B-A,C-D]\[C-A];
P = A+(B-A)*TS(1);
  1 Comment
Yoon Chang Jeon
Yoon Chang Jeon on 19 Nov 2017
Thanks! But It's result over range (x1 - x2) (x3 - x4), (y1 - y2) (y3 - y4). How can I find a result inside range?

Sign in to comment.

Community Treasure Hunt

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

Start Hunting!