How to resolve the algorithm Find the intersection of two lines step by step in the XPL0 programming language
Published on 12 May 2024 09:40 PM
How to resolve the algorithm Find the intersection of two lines step by step in the XPL0 programming language
Table of Contents
Problem Statement
Find the point of intersection of two lines in 2D.
The 1st line passes though (4,0) and (6,10) . The 2nd line passes though (0,3) and (10,7) .
Let's start with the solution:
Step by Step solution about How to resolve the algorithm Find the intersection of two lines step by step in the XPL0 programming language
Source code in the xpl0 programming language
func real Det; real A0, B0, A1, B1;
return A0*B1 - A1*B0;
func Cramer; real A0, B0, C0, A1, B1, C1;
real Denom;
[Denom:= Det(A0, B0, A1, B1);
RlOut(0, Det(C0, B0, C1, B1) / Denom);
RlOut(0, Det(A0, C0, A1, C1) / Denom);
];
real L0, L1, M0, M1;
[L0:= [[ 4., 0.], [ 6., 10.]];
L1:= [[ 0., 3.], [10., 7.]];
M0:= (L0(1,1) - L0(0,1)) / (L0(1,0) - L0(0,0));
M1:= (L1(1,1) - L1(0,1)) / (L1(1,0) - L1(0,0));
Cramer(M0, -1., M0*L0(0,0)-L0(0,1), M1, -1., M1*L1(0,0)-L1(0,1));
]
You may also check:How to resolve the algorithm Tau function step by step in the Delphi programming language
You may also check:How to resolve the algorithm Maze solving step by step in the J programming language
You may also check:How to resolve the algorithm Queue/Definition step by step in the J programming language
You may also check:How to resolve the algorithm Order disjoint list items step by step in the Arturo programming language
You may also check:How to resolve the algorithm Execute a system command step by step in the Maple programming language