aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAdrian Kummerlaender2019-09-14 19:43:00 +0200
committerAdrian Kummerlaender2019-09-14 19:43:00 +0200
commitac67606ba12ae9935ac86adca9aaca4d3f460280 (patch)
tree0bf008f7f37161093fc90daacdb663f277ea3c00
parent0845685ab4f45451ae76dbda1d7444ab420a7d72 (diff)
downloadsymlbm_playground-ac67606ba12ae9935ac86adca9aaca4d3f460280.tar
symlbm_playground-ac67606ba12ae9935ac86adca9aaca4d3f460280.tar.gz
symlbm_playground-ac67606ba12ae9935ac86adca9aaca4d3f460280.tar.bz2
symlbm_playground-ac67606ba12ae9935ac86adca9aaca4d3f460280.tar.lz
symlbm_playground-ac67606ba12ae9935ac86adca9aaca4d3f460280.tar.xz
symlbm_playground-ac67606ba12ae9935ac86adca9aaca4d3f460280.tar.zst
symlbm_playground-ac67606ba12ae9935ac86adca9aaca4d3f460280.zip
Randomly sample initial particle ages
-rw-r--r--utility/particles.py11
1 files changed, 5 insertions, 6 deletions
diff --git a/utility/particles.py b/utility/particles.py
index a75ed34..a7ef777 100644
--- a/utility/particles.py
+++ b/utility/particles.py
@@ -16,14 +16,13 @@ class Particles:
if len(grid[0,:]) == 2:
self.np_particles[:,0:2] = grid
- self.np_particles[:,2:4] = 0
- self.np_init_particles[:,0:2] = grid
- self.np_init_particles[:,2:4] = 0
+ self.np_particles[:,2] = 0
+ self.np_particles[:,3] = numpy.random.sample(self.count)
+ self.np_init_particles = self.np_particles
elif len(grid[0,:]) == 3:
self.np_particles[:,0:3] = grid
- self.np_particles[:,3] = 0
- self.np_init_particles[:,0:3] = grid
- self.np_init_particles[:,3] = 0
+ self.np_particles[:,3] = numpy.random.sample(self.count)
+ self.np_init_particles = self.np_particles
self.gl_particles = vbo.VBO(data=self.np_particles, usage=gl.GL_DYNAMIC_DRAW, target=gl.GL_ARRAY_BUFFER)
self.gl_particles.bind()