(self)
return particles
constructs an array of particles containing x, y and speed value for each particle
constructs an array of particles containing x, y and speed value for each particle
constructs an array of particles containing x y and speed value for each particle
def _initial_particles(self) -> np.ndarray:
        """ constructs an array of particles containing x, y and speed value for each particle """
        import numpy as np

        particles = np.zeros((self.NUM_PARTICLES, 4), dtype="float32")
        for index in range(particles.shape[0]):
            # Generate random particle
            phi = random.random() * 2 * math.pi
            radius_diff = random.random()
            x = math.cos(phi) * (0.2 + radius_diff * 0.05)
            y = math.sin(phi) * (0.15 + radius_diff * 0.05)
            z = self.PARTICLE_SPAWN_Z
            speed = 0.15 * (random.random() * 0.75 + 0.3)
            offset = random.random() * z

            particles[index] = [x, y, speed, offset]
        return particles
def _initial_particles ( self ) -> np . ndarray : import numpy as np particles = np . zeros ( ( self . NUM_PARTICLES , 4 ) , dtype = "float32" ) for index in range ( particles . shape [ 0 ] ) : # Generate random particle phi = random . random ( ) * 2 * math . pi radius_diff = random . random ( ) x = math . cos ( phi ) * ( 0.2 + radius_diff * 0.05 ) y = math . sin ( phi ) * ( 0.15 + radius_diff * 0.05 ) z = self . PARTICLE_SPAWN_Z speed = 0.15 * ( random . random ( ) * 0.75 + 0.3 ) offset = random . random ( ) * z particles [ index ] = [ x , y , speed , offset ] return particles