function labelPoints(points, centroids) {
    return points.map((p) => {
        let minDist = Number.MAX_VALUE;
        let label = -1;
        for (let i = 0; i < centroids.length; i++) {
            const dist = euclideanDistance(p, centroids[i]);
            if (dist < minDist) {
                minDist = dist;
                label = i;
            }
        }
        return label;
    });
}
Label each point according to which centroid it is closest to.

@private
@param {Array<Array<number>>} points Array of XY coordinates.
@param {Array<Array<number>>} centroids Current centroids.
@return {Array<number>} Group labels.