I am going to calculate the shortest distance from a point to a triangle(3d). I have projected the point to the plane of the triangle and than taken the barycentric coordinates of the projection of the point. But i could not find a way to clamp the coordinates to always be inside the triangle.

when searching I've only found the 0 <= [u,v,w] and u+v+w = 1. but how would this be solved?

Edit
Report