From 04a2f05d1c97329774361cfe06791b51fd99f0ae Mon Sep 17 00:00:00 2001 From: Andrew Brown Date: Sun, 13 Nov 2011 09:31:09 -0500 Subject: [PATCH] implemented stochhastic check with chunk scanning Also changed uniform(0,1) to random() --- overviewer_core/quadtree.py | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/overviewer_core/quadtree.py b/overviewer_core/quadtree.py index 83c0629..2e7f1bb 100644 --- a/overviewer_core/quadtree.py +++ b/overviewer_core/quadtree.py @@ -439,7 +439,7 @@ class QuadtreeGen(object): break # stochastic render check - if not needs_rerender and self.rerender_probability > 0.0 and random.uniform(0, 1) < self.rerender_probability: + if not needs_rerender and self.rerender_probability > 0.0 and random.random() < self.rerender_probability: needs_rerender = True # if after all that, we don't need a rerender, return @@ -538,6 +538,17 @@ class QuadtreeGen(object): dirty.set_dirty(tile.path) continue + # Stochastic check. Since we're scanning by chunks and not + # by tiles, and the tiles get checked multiple times for + # each chunk, this is only an approximation. The given + # probability is for a particular tile that needs + # rendering, but since a tile gets touched up to 32 times + # (once for each chunk in it), divide the probability by + # 32. + if self.rerender_probability and self.rerender_probability/32 > random.random(): + dirty.set_dirty(tile.path) + continue + # Check if this tile has already been marked dirty. If so, # no need to do any of the below. if dirty.query_path(tile.path):