Finding if a line intersects another.
조회 수: 2 (최근 30일)
이전 댓글 표시
I have the simultaneous solution of line 1 and line 2 for instance. This is a point where hey intersect. Say line one was between (1,2) to (2,3) how would i determine using if else end structure if this point lied along the line. NOTE It must not land on these end points (1,2) and (2,3).
댓글 수: 1
Star Strider
2014년 3월 26일
How does this differ from your other quesiton: http://www.mathworks.com/matlabcentral/answers/123251-solving-linear-equations-simultaneoulsy?
답변 (1개)
Image Analyst
2014년 3월 26일
Basic algebra. You have the equations of 2 lines. They intersect at the same y value. So y1=m1*x+b1 = y2=m2*x+b2. So (m1-m2)*x = (b2-b1) and x = (b2-b1)/(m1-m2). Then you can check if that x is between 1 and 2 by plugging in the slope parameters m, and the intercept parameters b.
댓글 수: 0
참고 항목
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!