pub fn init_dam_break(&mut self, dam_particles_x: usize, dam_particles_y: usize) -> bool {
        let fluid_orig = Vec2::new(-0.3, 1.8); // (left, bottom)
        let eps = 0.00001;

        if self.num_particles + dam_particles_x * dam_particles_y > MAX_PARTICLES {
            return false;
        }

        let mut i = self.num_particles;
        for y in 0..dam_particles_y {
            for x in 0..dam_particles_x {
                self.particles.pos[i].x = fluid_orig.x + x as f32 * PARTICLE_DIAMETER;
                self.particles.pos[i].x += eps * (y % 2) as f32;
                self.particles.pos[i].y = fluid_orig.y + y as f32 * PARTICLE_DIAMETER;
                self.particles.vel[i] = Vec2::ZERO;
                i += 1;
            }
        }
        self.num_particles += dam_particles_x * dam_particles_y;
        true
    }
/// Returns `false` if new particles would overflow `MAX_PARTICLES`
Returns `false` if new particles would overflow `MAX_PARTICLES`
Returns ` false ` if new particles would overflow ` MAX_PARTICLES `
pub fn init_dam_break(&mut self, dam_particles_x: usize, dam_particles_y: usize) -> bool {
        let fluid_orig = Vec2::new(-0.3, 1.8); // (left, bottom)
        let eps = 0.00001;
        if self.num_particles + dam_particles_x * dam_particles_y > MAX_PARTICLES {
            return false;
        }
        let mut i = self.num_particles;
        for y in 0..dam_particles_y {
            for x in 0..dam_particles_x {
                self.particles.pos[i].x = fluid_orig.x + x as f32 * PARTICLE_DIAMETER;
                self.particles.pos[i].x += eps * (y % 2) as f32;
                self.particles.pos[i].y = fluid_orig.y + y as f32 * PARTICLE_DIAMETER;
                self.particles.vel[i] = Vec2::ZERO;
                i += 1;
            }
        }
        self.num_particles += dam_particles_x * dam_particles_y;
        true
    }
pub fn init_dam_break ( & mut self , dam_particles_x : usize , dam_particles_y : usize ) -> bool { let fluid_orig = Vec2 :: new ( - 0.3 , 1.8 ) ; // (left, bottom) let eps = 0.00001 ; if self . num_particles + dam_particles_x * dam_particles_y > MAX_PARTICLES { return false ; } let mut i = self . num_particles ; for y in 0 .. dam_particles_y { for x in 0 .. dam_particles_x { self . particles . pos [ i ] . x = fluid_orig . x + x as f32 * PARTICLE_DIAMETER ; self . particles . pos [ i ] . x += eps * ( y % 2 ) as f32 ; self . particles . pos [ i ] . y = fluid_orig . y + y as f32 * PARTICLE_DIAMETER ; self . particles . vel [ i ] = Vec2 :: ZERO ; i += 1 ; } } self . num_particles += dam_particles_x * dam_particles_y ; true }
Returns `false` if new particles would overflow `MAX_PARTICLES`
Returns ` false ` if new particles would overflow ` MAX_PARTICLES `
&mut self
dam_particles_x
usize
dam_particles_y
usize
&mut self
dam_particles_x
usize
dam_particles_y
usize