Distance between a point and a triangle in 3D
Version 1.6.0.0 (2.99 KB) by
Gwendolyn Fischer
pointTriangleDistance calculates the distance between a point and a triangle in 3D.
Calculate the distance of a given point P from a triangle TRI.
Point P is a row vector of the form 1x3. The triangle is a matrix
formed by three rows of points TRI = [P1;P2;P3] each of size 1x3.
dist = pointTriangleDistance(TRI,P) returns the distance of the point P to the triangle TRI.
[dist,PP0] = pointTriangleDistance(TRI,P) additionally returns the closest point PP0 to P on the triangle TRI.
Cite As
Gwendolyn Fischer (2026). Distance between a point and a triangle in 3D (https://www.mathworks.com/matlabcentral/fileexchange/22857-distance-between-a-point-and-a-triangle-in-3d), MATLAB Central File Exchange. Retrieved .
MATLAB Release Compatibility
Created with
R14SP2
Compatible with any release
Platform Compatibility
Windows macOS LinuxCategories
Find more on Computational Geometry in Help Center and MATLAB Answers
Tags
Acknowledgements
Discover Live Editor
Create scripts with code, output, and formatted text in a single executable document.
