import Vector2 from "../../Vector2.js";

/**
 *
 * @param {Array.<AABB2>} boxes
 * @returns {Vector2}
 */
export function aabb2_compute_center_from_multiple(boxes) {
    const numBoxes = boxes.length;

    const center = new Vector2();

    for (let i = 0; i < numBoxes; i++) {

        const box = boxes[i];

        center._add(box.centerX, box.centerY);

    }

    center.multiplyScalar(1 / numBoxes);

    return center;
}
