FEATool
v1.7 Finite Element Analysis Toolbox |

geom_intersect_lines.m File Reference

GEOM_INTERSECT_LINES Compute intersection between two lines.

[ S, T, TF ] = GEOM_INTERSECT_LINES( P_L1, P_L2 ) Computes the intersection point of two lines defined by the points P_L1 = [x1 x2 y1 y2] and P_L2. Outputs are S and T which specify the relative position of the intersection points for each line, so that for example xi = x1+s*(x2-x1). TF is a boolean which indicates if the lines intersect within the segments defined by P1 (0<s<1) and P2 (0<t<1). Parallel non-intersecting lines return S and T = -inf, and TF = 0.