Let's define the distance from a point $P = (x,y)^T$ to a triangle defined by $X_1$, $X_2$ and $X_3$ with $X_i = (x_i, y_i)$ as the distance to the closest edge of the triangle. Let's define $b=(u,v,w)^T$ as the berycentric coordinates of $p$, therefore
$$ p = Ub = \left[\begin{matrix}x_1 & x_2 & x_3\\y_1 & y_2 & y_3 \\ 1&1&1\end{matrix}\right]\left( \begin{matrix}u\\v\\w\end{matrix}\right) $$
If we define $t_0$ as the projection of $p$ to the closest edge of the triangle in barycentric coordinates. Then we can define the distance $d$ as $d= |U(t_0-b)|$.
My question is how can I calculate $t_0$ in barycentric coordinates?