How to use this calculator
Find the nearest point anywhere on a finite 3D triangle, including its edges and corners.
- Enter Query point x y z, First triangle vertex, Second triangle vertex, Third triangle vertex. Match the units shown beside each field and review the result together with the assumptions below.
- Read the worked example below to check the expected input format and result.
- Compare another scenario by changing one input at a time. Use Reset to return to the starting values.
Closest point on a 3D triangle explained
The nearest point on a triangle may lie inside its face, on an edge, or at a vertex. The result is the nonnegative Euclidean distance from the query point to the nearest point on the entered nondegenerate triangle.
Inputs, symbols, and units
p— Query point x y z- Query point x y z. Use comma-separated values in the stated order.
a— First triangle vertex- First triangle vertex. Use comma-separated values in the stated order.
b— Second triangle vertex- Second triangle vertex. Use comma-separated values in the stated order.
c— Third triangle vertex- Third triangle vertex. Use comma-separated values in the stated order.
Formula and method
Minimize point distance over triangle face and edges
Project the query onto the supporting plane and check its triangle coordinates. If that projection lies outside, compute the closest clamped point on each of the three edges and choose the smallest distance. This explicitly includes corner solutions.
A worked scenario
Query point x y z = 0.2, 0.2, 2; First triangle vertex = 0, 0, 0; Second triangle vertex = 1, 0, 0; Third triangle vertex = 0, 1, 0.
- Point-to-triangle distance: 2 distance units
- Closest point: 0.2, 0.2, 0
Assumptions and edge cases
Nondegenerate triangle required; unlike a plane projection, the closest point is constrained to the triangle.
Frequently asked questions
Can the nearest point lie on an edge?
Yes, an outside projection is clamped to the appropriate edge or vertex.
Is this distance signed?
No, it is nonnegative Euclidean distance.
Can a collinear triangle be entered?
No.
How do I use the Closest point on a 3D triangle calculator?
Enter Query point x y z, First triangle vertex, Second triangle vertex, Third triangle vertex. Match the units shown beside each field and review the result together with the assumptions below.
What is a worked example of Closest point on a 3D triangle?
Query point x y z = 0.2, 0.2, 2; First triangle vertex = 0, 0, 0; Second triangle vertex = 1, 0, 0; Third triangle vertex = 0, 1, 0. Point-to-triangle distance: 2 distance units Closest point: 0.2, 0.2, 0
Read our calculation methodology.