
Function [t,lambda,epsilon] = intersection2dlines(r,a,s,b) returns the intersection point of two 2-dimensional lines. Line 1 is defined by point r and direction a: p = r + lambda*a. Line 2 is defined by point s and direction b: q = s + epsilon*b. The function returns the intersection point t, and the parameters lambda and epsilon, which define the intersection point on the respective lines. If the lines do not intersect, t, lambda and epsilon have values NA. Matrices r, a, s, b, p, q and t have 2 columns, which contain the x,y coordinates, respectively. Output arguments lambda and epsilon have 1 column. The validity of the input is not checked! (c) 2026 fabien van mook 2026.08.20 release of this file within package "fvm-geometry" under GNU GPLv3+