import { assert } from "../../../assert.js";
import { aabb3_intersects_frustum_degree } from "./aabb3_intersects_frustum_degree.js";


/**
 *
 * @param {number[]|Float32Array} aabb
 * @param {number} aabb_offset
 * @param {number[]|Float32Array} frustum
 * @returns {number}
 */
export function aabb3_array_intersects_frustum_degree(aabb, aabb_offset, frustum) {

    assert.defined(frustum, 'frustum');
    assert.isNonNegativeInteger(aabb_offset, 'aabb_offset');

    const x0 = aabb[aabb_offset];
    const y0 = aabb[aabb_offset + 1];
    const z0 = aabb[aabb_offset + 2];
    const x1 = aabb[aabb_offset + 3];
    const y1 = aabb[aabb_offset + 4];
    const z1 = aabb[aabb_offset + 5];

    return aabb3_intersects_frustum_degree(
        x0, y0, z0,
        x1, y1, z1,
        frustum
    );
}
