Exemplo n.º 1
0
        public FireMap(int width, int height, bool random)
        {
            Width  = width;
            Height = height;

            _firemap = new FireCell[width, height];

            for (int x = 0; x < width; x++)
            {
                for (int y = 0; y < height; y++)
                {
                    _firemap[x, y] = FireCell.Random();
                }
            }
            RandomFireStarts();
        }
Exemplo n.º 2
0
        //public double WindXIntensity { get; set; }
        //public double WindYIntensity { get; set; }

        //private double[] GenerateWindFactor()
        //{
        //    double[] data = new double[8];
        //    data[0] = 0.5; //0, 0
        //    data[1] = 1;   //0, 1
        //    data[2] = 0.5; //0, 2

        //    data[3] = 1;   //1, 0
        //    data[4] = 1;   //1, 2

        //    data[5] = 0.5; //2, 0
        //    data[6] = 1;   //2, 1
        //    data[7] = 0.5; //2, 2
        //    return data;
        //}

        private FireCell[] GetNeighbourhood(FireMap fm, int x, int y)
        {
            FireCell[] firecells = new FireCell[]
            { fm._firemap[x - 1, y - 1],
              fm._firemap[x - 1, y],
              fm._firemap[x - 1, y + 1],
              fm._firemap[x, y - 1]
              , fm._firemap[x, y + 1],
              fm._firemap[x + 1, y - 1],
              fm._firemap[x + 1, y],
              fm._firemap[x + 1, y + 1] };
            double[] wf = GenerateWindFactor();
            for (int i = 0; i < 8; i++)
            {
                firecells[i].DirectionWeighting = wf[i];
            }

            return(firecells);
        }