Function spherical_cow::pack_spheres [−][src]
pub fn pack_spheres<C: Container, D: Distribution<f64>>(
container: &C,
size_distribution: &mut D
) -> Result<Vec<Sphere>, Error>
Packs all habitat spheres to be as dense as possible.
Requires a containter
and a distribution of radii sizes.
Generally, a uniform distribution is chosen, although this library
accepts any distribution implementing rand
s Distribution
trait.
This example
uses a normally distributed radii range. Note that the packing is sub optimal in this case, and
attention must be paid when using such distributions that radii values do not become negagive.