Skip to main content

product_bounds_with

Function product_bounds_with 

Source
pub fn product_bounds_with<B: MeshCompiler>(
    backend: &B,
    model: &Model,
    product: EntityId,
    tolerance: Tolerance,
) -> GeometryResult<Option<ProductBounds>>
Expand description

The world-space axis-aligned bounding box of one product’s body.

The body is resolved and placed exactly as compile_product_mesh_with does, and returns Ok(None) in the same case: a product with no body representation. When every leaf is a mesh, an authored bounding box, a linear extrusion of a straight-edged profile or a block, the box is read off the lowered graph from their vertices without tessellating (BoundsSource::Exact). Otherwise – a curved profile or surface, a boolean – the body is compiled with backend and the mesh’s bounds are used (BoundsSource::Tessellated).

The result feeds a spatial index such as axiolid_spatial::Bvh directly; this crate computes the leaf boxes and leaves the index to Axiolid.

§Errors

Any lowering error, GeometryError::CompilationRefused when the fallback cannot compile, and GeometryError::Degenerate when the body has no finite extent (an empty or non-finite mesh): an empty box is not a bound.