Function distance_to_bounds

Source
pub fn distance_to_bounds(bounds: Bounds, model: Mat4, eye: Vec3) -> f32
Expand description

Distance to the nearest point on the conservative world AABB. Invalid bounds, non-affine/nonfinite transforms, nonfinite eyes or overflow in transformed bounds return zero: unknown bounds must not force a far LOD. Valid distances larger than f32::MAX return infinity.

use ferravex_graphics::Bounds;
use ferravex_render::{Mat4, Vec3, visibility::distance_to_bounds};
let bounds = Bounds { min: -Vec3::ONE, max: Vec3::ONE };
assert_eq!(distance_to_bounds(bounds, Mat4::IDENTITY, Vec3::X * 4.0), 3.0);