From a simulation object, this function samples bounding boxes of a custom size until a number of cells of a certain species are not sampled. If this never happens, after a fixed number of attempts the best box is returned.
Examples
sim <- SpatialSimulation()
sim$add_mutant(name = "A", growth_rates = 0.08, death_rates = 0.01)
sim$place_cell("A", 500, 500)
sim$run_up_to_time(60)
#>
[████████████████████████████████████████] 100% [00m:00s] Saving snapshot
bbox <- bbox_sampler(sim, "A", n = 15, n_w = 5, n_h = 5)
sim$sample_cells("A", bbox$p, bbox$q)
plot_tissue(sim)