Weighted Average Distance between 3 or more points

I'm trying to find out the average point between 3 or more points, given each distance that the end point is away from each of the other points.

With 2 points it's easy, I believe the formula should be:

$x_p =\dfrac{(x_1 * d_2) + (x_2 * d_1)}{d_1 + d_2}$, $y_p =\dfrac{(y_1 * d_2) + (y_2 * d_1)}{d_1 + d_2}$

With 3 points and 3 distances I tried to follow that same logic and take it a step further by using:

$x_p =\dfrac{(x_1 * d_2 * d_3) + (x_2 * d_1 * d_3) + (x_3 * d_1 * d_2)}{d_1 + d_2 + d_3}$

$y_p =\dfrac{(y_1 * d_2 * d_3) + (y_2 * d_1 * d_3) + (y_3 * d_1 * d_2)}{d_1 + d_2 + d_3}$

However this doesn't end up giving me the same answer. Instead it gives me a point that ends up being nowhere near the center of the 3 initial points. Is there a way to take the weighted average between 3 points to find the end point? Any help would be great, thank you!

In the case of two points, the weights would be $w_1 = \dfrac{\frac{1}{d_1}}{\frac{1}{d_1}+\frac{1}{d_2}} = \frac{d_2}{d_1+d_2}$ and $w_2 = \frac{d_1}{d_1+d_2}$

This you got it correctly.

Now for the case of three points

$w_1 = \dfrac{\frac{1}{d_1}}{\frac{1}{d_1}+\frac{1}{d_2}+\frac{1}{d_2}} = \frac{d_2d_3}{d_1d_2+d_1d_3+d_2d_3}$ and $w_2 = \frac{d_1d_3}{d_1d_2+d_1d_3+d_2d_3}$$w_3 = \frac{d_1d_2}{d_1d_2+d_1d_3+d_2d_3}$

Your problem is you are dividing by $(d_1+d_2+d_3)$

If you try this it will work.

Good luckk

Satish

To be honest, I don't understand what are your distances $d_1, d_2, d_3$ and what is their role...

I assume two things in the following:

• First case: the distances $d_1, d_2, d_3$ means nothing at all, and are meaningless

• Second case: the distance $d_1, d_2, d_3$ are the weights associated to each of the point $P_1, P_2, P_3$

The general function to get the average point $A$ is

$x_A=\dfrac{x_1+x_2+x_3}{3}$ and $y_A=\dfrac{y_1+y_2+y_3}{3}$

However, IF you want to weight each point $P_1, P_2, P_3$, with what you call distance but is more a weight, you get the coordinates of the barycenter $B$:

$x_B=\dfrac{x_1*d_1+x_2*d_2+x_3*d_3}{d_1+d_2+d_3}$

$y_B=\dfrac{y_1*d_1+y_2*d_2+y_3*d_3}{d_1+d_2+d_3}$

• The problem is the distances need to be inversed weights, rather than pure weights. If d1 is the largest distance, using your method the end point is going to end up being closest to p1, when it should be the farthest because d1 is the largest distance. With my 2-point equation it swaps the weights in order to account for this, but I'm not sure how to do the same with the 3-point equation – Gregory Salvesen Jun 23 '15 at 16:40