function meanDistanceFromPointToGroup(which, group, distances) {
    let total = 0;
    for (let i = 0; i < group.length; i++) {
        total += distances[which][group[i]];
    }
    return total / group.length;
}
Calculate the mean distance between a point and all the points in a group
(possibly its own).

@private
@param {number} which The index of this point.
@param {Array<number>} group The indices of all the points in the group in
question.
@param {Array<Array<number>>} distances A symmetric square array of inter-point
distances.
@return {number} The mean distance from this point to others in the
specified group.