diff options
author | Thomas Jourdan <b.vehikel@googlemail.com> | 2010-01-03 10:49:23 (GMT) |
---|---|---|
committer | Thomas Jourdan <b.vehikel@googlemail.com> | 2010-01-03 10:49:23 (GMT) |
commit | 9e2fd70f8e06e550baf1e396568e6c9674b3d08f (patch) | |
tree | fcd3a2b8df82cd4b2bf0cb22843c9a3ffed6c3f1 /ep_layer_markovchain.py | |
parent | ee878465ad84f8b2fd25eccf690ea29dde27e7df (diff) |
Added stamps using SVG files.
Bug fixed in the minimal distance calculation of Voronoi diagrams.
Diffstat (limited to 'ep_layer_markovchain.py')
-rw-r--r-- | ep_layer_markovchain.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/ep_layer_markovchain.py b/ep_layer_markovchain.py index b245556..b1a8aed 100644 --- a/ep_layer_markovchain.py +++ b/ep_layer_markovchain.py @@ -25,10 +25,10 @@ import model_random import ka_factory from gettext import gettext as _ -#NUMBER_OF_TILES_CONSTRAINT = 'number_of_tiles_constraint' -NUMBER_OF_STATES_CONSTRAINT = 'number_of_states_constraint' -SAMPLERTYPE_CONSTRAINT = 'samplertype_constraint' -STAMPTYPE_CONSTRAINT = 'stamptype_constraint' +#NUMBER_OF_TILES_CONSTRAINT = 'number_of_tilesconstraint' +NUMBER_OF_STATES_CONSTRAINT = 'number_of_statesconstraint' +SAMPLERTYPE_CONSTRAINT = 'samplertypeconstraint' +STAMPTYPE_CONSTRAINT = 'stamptypeconstraint' class MarkovChainLayer(model_layer.Layer): """Markov chain layer @@ -265,6 +265,8 @@ class MarkovChainLayer(model_layer.Layer): pre: width == height """ self.begin_render(ctx, width, height) + dw, dh = self.sampler.get_sample_extent() + self.stamp.set_extent(dw, dh) cell_rand = random.Random(self.random_seed) cell_state = 0 for point in self.sampler.get_sample_points(): @@ -273,6 +275,7 @@ class MarkovChainLayer(model_layer.Layer): self.stamp.render(ctx, (point[0]-0.5, point[1]-0.5), state=cell_state) cell_state = self._next_state(cell_state, cell_rand) +# cell_state = (cell_state+1) % len(self.cell_colors) def _next_state(self, cell_state, cell_rand): next_cell_state = self.states-1 |