Fast shortest distance between two line segments (in N dimensions)

Shortest distance between two line segments in N dimensions

You are now following this Submission

This function implements the fast algorithm proposed in Vladimir J. LUMELSKY, "On fast computation of distance between line segments," Information Processing Letters 21 (1985) 55-61. for computing the shortest distance between two line segments.
It handles all degenerate cases as well (when the lines are parallel, one line is a point, both lines are points).

Optionally, the function can return the closest two points on the line segments.

Cite As

Ondrej (2026). Fast shortest distance between two line segments (in N dimensions) (https://nl.mathworks.com/matlabcentral/fileexchange/49502-fast-shortest-distance-between-two-line-segments-in-n-dimensions), MATLAB Central File Exchange. Retrieved .

Acknowledgements

Inspired by: Shortest distance between two line segments

Categories

Find more on Computational Geometry in Help Center and MATLAB Answers

General Information

MATLAB Release Compatibility

  • Compatible with any release

Platform Compatibility

  • Windows
  • macOS
  • Linux
Version Published Release Notes Action
1.0.0.0