Distance Between Two Triangles

Finds the shortest distance between two triangles in 3d space.
5 Downloads
Updated 20 Jan 2023

View License

This function finds the shortest distance between two triangles in 3d space using nonlinear constrained optimization.
function d=Distance2Triangles(va1,va2,va3,vb1,vb2,vb3)
where:
va1 is (3*1) coordinate vector for the first vertex of triangle a.
va2 is (3*1) coordinate vector for the second vertex of triangle a.
va3 is (3*1) coordinate vector for the third vertex of triangle a.
vb1 is (3*1) coordinate vector for the first vertex of triangle b.
vb2 is (3*1) coordinate vector for the second vertex of triangle b.
vb3 is (3*1) coordinate vector for the third vertex of triangle b.
d is the shortest distance between triangle a and triangle b.

Cite As

Ayad Al-Rumaithi (2024). Distance Between Two Triangles (https://www.mathworks.com/matlabcentral/fileexchange/123620-distance-between-two-triangles), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2017b
Compatible with any release
Platform Compatibility
Windows macOS Linux
Tags Add Tags

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Published Release Notes
1.0.0