File Exchange

## Intersection of Two Lines (line_intersection)

version 2.0.2 (140 KB) by
Finds the intersection of two lines.

Updated 27 Mar 2021

From GitHub

See https://github.com/tamaskis/line_intersection-MATLAB or “DOCUMENTATION.pdf” for additional documentation and examples. Examples can also be found in “EXAMPLES.m”.

The "line_intersection" function finds the intersection of two lines. The lines can be specified in either slope-intercept form or point-slope form. This function is not intended to replace MATLAB's "polyxpoly", where the two lines are each defined by two points. In many cases, it is inconvenient to redefine a line using two points, which was the reason for the creation of the “line_intersection” function

As an example, we can consider the case when we are using the method of characteristics to solve for the nonsimple internal points in the reflection of an expansion wave. We will have two nonsimple internal points and the slopes of the characteristic lines through those points, and we need to find the intersection of these lines to find the next nonsimple internal point. Since we have two points and two slopes, we can use the "line_intersection" function to find the next nonsimple internal point. While we could define a second hypothetical point on each of the characteristic lines to use the built-in "polyxpoly" function, if we don't define these second points far enough away, the lines will not intersect. Therefore, it is much more convenient to use the "line_intersection" function, which is more robust in this case.

### Cite As

Tamas Kis (2021). Intersection of Two Lines (line_intersection) (https://github.com/tamaskis/line_intersection-MATLAB/releases/tag/v2.0.2), GitHub. Retrieved .