/**
 * Distance of the farthest point along the plane normal from the plane. If the result is >= 0, at least a portion of AABB pokes above the plane
 * @param {number} plane_normal_x
 * @param {number} plane_normal_y
 * @param {number} plane_normal_z
 * @param {number} plane_constant
 * @param {number} _x0
 * @param {number} _y0
 * @param {number} _z0
 * @param {number} _x1
 * @param {number} _y1
 * @param {number} _z1
 * @returns {number}
 */
export function aabb3_compute_distance_above_plane_max(
    plane_normal_x, plane_normal_y, plane_normal_z, plane_constant,
    _x0, _y0, _z0,
    _x1, _y1, _z1
) {

    // pick a corner point that is the closest along the plane normal
    const px = plane_normal_x > 0 ? _x1 : _x0;
    const py = plane_normal_y > 0 ? _y1 : _y0;
    const pz = plane_normal_z > 0 ? _z1 : _z0;

    // dot(v4,v4) inlined for speed
    return plane_constant + plane_normal_x * px + plane_normal_y * py + plane_normal_z * pz;
}
