export function aabb3_signed_distance_to_aabb3(
    ax0,ay0,az0,ax1,ay1,az1,
    bx0,by0,bz0, bx1,by1,bz1
){

    //do projection
    const xp0 = bx0 - ax1;
    const xp1 = ax0 - bx1;
    const yp0 = by0 - ay1;
    const yp1 = ay0 - by1;
    const zp0 = bz0 - az1;
    const zp1 = az0 - bz1;

    //calculate separation in each axis
    const dx = Math.max(xp0, xp1);
    const dy = Math.max(yp0, yp1);
    const dz = Math.max(zp0, zp1);

    //straight-line distance
    let distance = Math.sqrt(dx * dx + dy * dy + dz * dz);

    if (dx < 0 && dy < 0 && dz < 0) {
        //penetration
        return -distance;
    } else {
        return distance;
    }
}