pub(crate) fn layer_containing_aabb(aabb: &AABB) -> i8 {
    // Max number of elements of this size we would like one region to be able to contain.
    const NUM_ELEMENTS_PER_DIMENSION: Real = 10.0;

    let width = 2.0 * aabb.half_extents().norm() * NUM_ELEMENTS_PER_DIMENSION;
    (width / REGION_WIDTH_BASE)
        .log(REGION_WIDTH_POWER_BASIS)
        .round()
        .max(i8::MIN as Real)
        .min(i8::MAX as Real) as i8
}
/// Computes the depth of the layer the given AABB should be part of.
///
/// The idea here is that an AABB should be part of a layer which has
/// regions large enough so that one AABB doesn't crosses too many
/// regions. But the regions must also not be too large, otherwise
/// we are loosing the benefits of Multi-SAP.
///
/// If the code bellow, we select a layer such that each region can
/// contain at least a chain of 10 contiguous objects with that AABB.
Computes the depth of the layer the given AABB should be part of.
The idea here is that an AABB should be part of a layer which has
regions large enough so that one AABB doesn't crosses too many
regions. But the regions must also not be too large, otherwise
we are loosing the benefits of Multi-SAP.

If the code bellow, we select a layer such that each region can
contain at least a chain of 10 contiguous objects with that AABB.
Computes the depth of the layer the given AABB should be part of . The idea here is that an AABB should be part of a layer which has regions large enough so that one AABB doesn ' t crosses too many regions . But the regions must also not be too large otherwise we are loosing the benefits of Multi - SAP . If the code bellow we select a layer such that each region can contain at least a chain of 10 contiguous objects with that AABB .
pub(crate) fn layer_containing_aabb(aabb: &AABB) -> i8 {
    // Max number of elements of this size we would like one region to be able to contain.
    const NUM_ELEMENTS_PER_DIMENSION: Real = 10.0;
    let width = 2.0 * aabb.half_extents().norm() * NUM_ELEMENTS_PER_DIMENSION;
    (width / REGION_WIDTH_BASE)
        .log(REGION_WIDTH_POWER_BASIS)
        .round()
        .max(i8::MIN as Real)
        .min(i8::MAX as Real) as i8
}
pub ( crate ) fn layer_containing_aabb ( aabb : & AABB ) -> i8 { // Max number of elements of this size we would like one region to be able to contain. const NUM_ELEMENTS_PER_DIMENSION : Real = 10.0 ; let width = 2.0 * aabb . half_extents ( ) . norm ( ) * NUM_ELEMENTS_PER_DIMENSION ; ( width / REGION_WIDTH_BASE ) . log ( REGION_WIDTH_POWER_BASIS ) . round ( ) . max ( i8 :: MIN as Real ) . min ( i8 :: MAX as Real ) as i8 }
Computes the depth of the layer the given AABB should be part of.
Computes the depth of the layer the given AABB should be part of .
aabb
&AABB