import { aabb3_near_distance_to_intersection_ray_segment } from "./aabb3_near_distance_to_intersection_ray_segment.js";

/**
 * @see Ray Tracing Gems II, Chapter 2 "RAY AXIS-ALIGNED BOUNDING BOX INTERSECTION"
 * @param {number[]|Float32Array} box
 * @param {number} box_address
 * @param {number} origin_x
 * @param {number} origin_y
 * @param {number} origin_z
 * @param {number} inv_direction_x 1/ direction_X
 * @param {number} inv_direction_y 1/ direction_Y
 * @param {number} inv_direction_z 1/ direction_Z
 * @param {number} min_distance
 * @param {number} max_distance
 * @returns {number}
 */
export function aabb3_array_near_distance_to_intersection_ray_segment(
    box, box_address,
    origin_x, origin_y, origin_z,
    inv_direction_x, inv_direction_y, inv_direction_z,
    min_distance, max_distance) {
    return aabb3_near_distance_to_intersection_ray_segment(
        box[box_address], box[box_address + 1], box[box_address + 2],
        box[box_address + 3], box[box_address + 4], box[box_address + 5],

        origin_x, origin_y, origin_z,
        inv_direction_x, inv_direction_y, inv_direction_z,
        min_distance, max_distance
    );
}