Diffuse2d
Name
Diffuse2d -- 2d difussion with evaporation.
Description
Discrete 2nd order approximation to 2d diffusion with evaporation. Math is done in integers on the range [0,0x7fff].
Methods
Phase: Creating
-
initializeLattice Initialize world to 0.
+
create: (id <Zone>)
aZone setSizeX: (unsigned)
x Y: (unsigned)
y setDiffusionConstant: (double)
d setEvaporationRate: (double)
e Convenience constructor for Diffuse2d
Phase: Setting
-
setEvaporationRate: (double)
e Set the evaporation rate. Values over 1.0 don't make much sense
-
setDiffusionConstant: (double)
d Set the diffusion constant. Values over 1.0 might not be valid.
Phase: Using
-
stepRule Run discrete approximation to diffusion. Roughly, it's newHeat = evapRate * (self + diffuseConstant*(nbdavg - self)) where nbdavg is the weighted average of the 8 neighbours.