pub fn distance(&self, position: &Vec3) -> f32 {
        let x = (self.min.x - position.x)
            .max(position.x - self.max.x)
            .max(0.0);
        let y = (self.min.y - position.y)
            .max(position.y - self.max.y)
            .max(0.0);
        let z = (self.min.z - position.z)
            .max(position.z - self.max.z)
            .max(0.0);
        let d2 = x * x + y * y + z * z;
        if d2 > 0.001 {
            d2.sqrt()
        } else {
            d2
        }
    }
///
/// The distance from position to the point in this bounding box that is closest to position.
///
The distance from position to the point in this bounding box that is closest to position.
The distance from position to the point in this bounding box that is closest to position .
pub fn distance(&self, position: &Vec3) -> f32 {
        let x = (self.min.x - position.x)
            .max(position.x - self.max.x)
            .max(0.0);
        let y = (self.min.y - position.y)
            .max(position.y - self.max.y)
            .max(0.0);
        let z = (self.min.z - position.z)
            .max(position.z - self.max.z)
            .max(0.0);
        let d2 = x * x + y * y + z * z;
        if d2 > 0.001 {
            d2.sqrt()
        } else {
            d2
        }
    }
pub fn distance ( & self , position : & Vec3 ) -> f32 { let x = ( self . min . x - position . x ) . max ( position . x - self . max . x ) . max ( 0.0 ) ; let y = ( self . min . y - position . y ) . max ( position . y - self . max . y ) . max ( 0.0 ) ; let z = ( self . min . z - position . z ) . max ( position . z - self . max . z ) . max ( 0.0 ) ; let d2 = x * x + y * y + z * z ; if d2 > 0.001 { d2 . sqrt ( ) } else { d2 } }
The distance from position to the point in this bounding box that is closest to position.
The distance from position to the point in this bounding box that is closest to position .
&self
position
&Vec3
&self
position
&Vec3