Skip to content

tamaskis/line_intersection-MATLAB

Repository files navigation

line_intersection View Intersection of Two Lines (line_intersection) on File Exchange Open in MATLAB Online

Finds the intersection of two lines.

Syntax

[x_int,y_int] = line_intersection(l1,l2)

Inputs

  • l1 (1×1, 1×2, 1×3, or 1×4 double) vector defining line 1:
    • [x1]: vertical line form,
    • [m1,b1]: slope-intercept form,
    • [x1,y1,m1]: point-slope form,
    • [x1,y1,x2,y2]: two point form,
  • l2 (1×1, 1×2, 1×3, or 1×4 double) vector defining line 2:
    • [x2]: vertical line form,
    • [m2,b2]: slope-intercept form,
    • [x2,y2,m2]: point-slope form,
    • [x3,y3,x4,y4]: two point form,

Outputs

  • x_int (1×1 double): -coordinate of line intersection,
  • y_int (1×1 double): -coordinate of line intersection,

Examples and Additional Documentation

  • See "EXAMPLES.mlx" or the "Examples" tab on the File Exchange page for examples.
  • See "Intersection_of_Two_Lines.pdf" (also included with download) for the technical documentation.