fn add_seeds(&mut self, particles: usize) {
        debug!("Adding {} seed particles", particles);

        for _ in 0..particles {
            let coords = self.generate_random_coord();
            let particle = Particle {
                // TODO: Variable dimensionality
                coordinates: if particles == 1 {
                    [0.0, 0.0]
                } else {
                    // TODO: Maybe there's other seed patterns that could be neat.
                    [
                        coords[0] * (5.0 + particles as f64 / 10.0),
                        coords[1] * (5.0 + particles as f64 / 10.0),
                    ]
                },
                join_attempts: 0,
            };
            let particle_index = self.particle_graph.add_node(particle);
            // TODO: How to avoid copying the coordinates?
            self.index
                .add(particle.coordinates, particle_index)
                .expect("Failed to add seed to spatial index");
        }
    }
/// Add starting seeds to the DLA model.
Add starting seeds to the DLA model.
Add starting seeds to the DLA model .
fn add_seeds(&mut self, particles: usize) {
        debug!("Adding {} seed particles", particles);
        for _ in 0..particles {
            let coords = self.generate_random_coord();
            let particle = Particle {
                // TODO: Variable dimensionality
                coordinates: if particles == 1 {
                    [0.0, 0.0]
                } else {
                    // TODO: Maybe there's other seed patterns that could be neat.
                    [
                        coords[0] * (5.0 + particles as f64 / 10.0),
                        coords[1] * (5.0 + particles as f64 / 10.0),
                    ]
                },
                join_attempts: 0,
            };
            let particle_index = self.particle_graph.add_node(particle);
            // TODO: How to avoid copying the coordinates?
            self.index
                .add(particle.coordinates, particle_index)
                .expect("Failed to add seed to spatial index");
        }
    }
fn add_seeds ( & mut self , particles : usize ) { debug ! ( " " particles ) ; for _ in 0 .. particles { let coords = self . generate_random_coord ( ) ; let particle = Particle { // TODO: Variable dimensionality coordinates : if particles == 1 { [ 0.0 , 0.0 ] } else { // TODO: Maybe there's other seed patterns that could be neat. [ coords [ 0 ] * ( 5.0 + particles as f64 / 10.0 ) , coords [ 1 ] * ( 5.0 + particles as f64 / 10.0 ) , ] } , join_attempts : 0 , } ; let particle_index = self . particle_graph . add_node ( particle ) ; // TODO: How to avoid copying the coordinates? self . index . add ( particle . coordinates , particle_index ) . expect ( " " ) ; } }
Add starting seeds to the DLA model.
Add starting seeds to the DLA model .
&mut self
particles
usize
&mut self
particles
usize