Vous suivez désormais cette soumission
- Les mises à jour seront visibles dans votre flux de contenu suivi
- Selon vos préférences en matière de communication il est possible que vous receviez des e-mails
Computes the shortest distance between two line segments given start and end points for each. Adapts the algorithm found on Dan Sunday's website (http://softsurfer.com/Archive/algorithm_0106/algorithm_0106.htm#dist3D_Segment_to_Segment
).
Usage: Input the start and end x,y,z coordinates for two line segments.
p1, p2 are [x,y,z] coordinates of first line segment and p3,p4 are for
second line segment.
Output: scalar minimum distance between the two segments.
Example:
P1 = [0 0 0]; P2 = [1 0 0];
P3 = [0 1 0]; P4 = [1 1 0];
dist = DistBetween2Segment(P1, P2, P3, P4)
dist =
1
Citation pour cette source
Nick (2026). Shortest distance between two line segments (https://fr.mathworks.com/matlabcentral/fileexchange/32487-shortest-distance-between-two-line-segments), MATLAB Central File Exchange. Extrait(e) le .
Remerciements
Inspiré par : Shortest Distance Between Two Lines in N dimensions
A inspiré : Fast shortest distance between two line segments (in N dimensions)
Informations générales
- Version 1.1.0.0 (2,8 ko)
Compatibilité avec les versions de MATLAB
- Compatible avec toutes les versions
Plateformes compatibles
- Windows
- macOS
- Linux
| Version | Publié le | Notes de version | Action |
|---|---|---|---|
| 1.1.0.0 | I have updated the function to now give a variety of outputs. The default output is still the distance, however you can also output the vector connecting the two closest points and the coordinates of those points on the lines. |
||
| 1.0.0.0 |
