What is the average of the points \blue{A}
, \pink{B}
and \green{C}
with weights
\blue{WEIGHT_A}
, \pink{WEIGHT_B}
and \green{WEIGHT_C}
respectively?
(
XM, YM)
For a weighted average, each value is multiplied by a weight, then the results are summed and divided by the sum of the weights.
First find the sum of the weights.
\blue{WEIGHT_A} + \pink{WEIGHT_B} + \green{WEIGHT_C} = TOTAL_WEIGHT
So the weighted average of the three points, call it \purple{M}
, is:
\purple{M} = \dfrac{\blue{WEIGHT_AA} + \pink{WEIGHT_BB} + \green{WEIGHT_CC}}
{TOTAL_WEIGHT}
The x
coordinate of \purple{M}
is the weighted average of the x
coordinates.
\purple{M_x} = \dfrac{1}{TOTAL_WEIGHT}\bigl(
\blue{WEIGHT_A \cdot A_x} +
\pink{WEIGHT_B \cdot B_x} +
\green{WEIGHT_C \cdot C_x}\bigr)
\purple{M_x} = \dfrac{1}{TOTAL_WEIGHT}\bigl(
\blue{WEIGHT_A \cdot negParens(XA)} +
\pink{WEIGHT_B \cdot negParens(XB)} +
\green{WEIGHT_C \cdot negParens(XC)}\bigr)
\purple{M_x} = \dfrac{1}{TOTAL_WEIGHT}(SUM_X)
\purple{M_x = XM_FRACTION}
The y
coordinate of \purple{M}
is the weighted average of the y
coordinates.
\purple{M_y} = \dfrac{1}{TOTAL_WEIGHT}\bigl(
\blue{WEIGHT_A \cdot A_y} +
\pink{WEIGHT_B \cdot B_y} +
\green{WEIGHT_C \cdot C_y}\bigr)
\purple{M_y} = \dfrac{1}{TOTAL_WEIGHT}\bigl(
\blue{WEIGHT_A \cdot negParens(YA)} +
\pink{WEIGHT_B \cdot negParens(YB)} +
\green{WEIGHT_C \cdot negParens(YC)}\bigr)
\purple{M_y} = \dfrac{1}{TOTAL_WEIGHT}(SUM_Y)
\purple{M_y = YM_FRACTION}
\purple{M} = (\purple{M_x}, \purple{M_y}) = \left(\purple{XM_FRACTION}, \purple{YM_FRACTION}\right)