Approximating a fourth point with a weighted average between three points?

Given three points $$\p_1,p_2,p_3\$$, how would one approximate the best positive weights $$\(u, v, w)\$$ such that $$\u+v+w = 1\$$ and that the distance between the new $$\up_0 + vp_1 + wp_2\$$ from $$\p_3\$$ is minimal?

Basically, the enemy's unit is positioned between several "bases" on a 2d plainand it's easy to tell which is closest or even find the "weights" between two bases $$\(t, 1-t)\$$ to compute the relative fractions (eg. 0.3, 0.7). How does one find the optimal weights for three surrounding points?

• Why do you want to find specifically points with u+v+w = 1, when you are interested in the distance/influence? Why not just compute/compare distances to said 3 points? Nov 2 '16 at 17:03
• This is just chaining together two common operations: 1) find the closest point to p3 on the plane containing p0p1p2 (hint: find the normal n to that plane, then your in-plane point q = p3 - n * dot(n, p3 - p0)) 2) find the Barycentric coordinates of q within the triangle p0p1p2 Nov 2 '16 at 17:16