jagua_rs::collision_detection::hpg::grid_generator

Function generate

Source
pub fn generate(
    bbox: AARectangle,
    hazards: &[Hazard],
    target_n_cells: usize,
) -> Vec<AARectangle>
Expand description

Generates a grid of equal sized square rectangles within a bounding box. All hazards are regarded as exterior regions, and will not contain cells. The number of cells is approximately equal to target_n_cells, but can be slightly more or less This is due to the fact that the cells are always remain square, so we cannot guarantee an exact number of cells