Exemplo n.º 1
0
        //runs the batch simulation
        public void RunBatchSimulation()
        {
            feedA = 0.001;
            killB = 0.001;
            double diffA = 0;
            double diffB = 0;
            IColourPicker colourScheme = new GrayScaleColours();
            for(int i = 0; i < 3; i++)
            {
                //set laplacian function and related diffusion rates
                if(i == 0)
                {
                    lapFunc = LaplacianFunctions.PerpendicularLaplacian;
                    diffA = perpDiffA;
                    diffB = PerpDiffB;
                }
                else if (i == 1)
                {
                    lapFunc = LaplacianFunctions.ConvolutionLaplacian;
                    diffA = convDeltDiffA;
                    diffB = convDeltDiffB;
                }
                else if (i == 2)
                {
                    lapFunc = LaplacianFunctions.DeltaMeansLaplacian;
                    diffA = convDeltDiffA;
                    diffB = convDeltDiffB;
                }

                //changes feed A until it reaches 0.099
                while(feedA <= 0.099)
                {
                    //changes kill b untill it reaches 0.099
                    while (killB <= 0.099)
                    {
                        //makes a new grid with those numbers
                        grid = new Grid(canvas, bounds, lapFunc, colourScheme, cellSize, gridSize, diffA, diffB, feedA, killB);
                        //runs throught the simulation for 5000 iterations - enough to become stable
                        for (int j = 0; j < numOfIterations; j++)
                        {
                            grid.GetCellsNextValues();
                            grid.UpdateCellsValues();
                        }
                        //once it has become stable draws to screen then saves the image
                        grid.DrawGrid();
                        formGraphics.DrawImage(pattern, 0, 0);
                        SaveImage();

                        killB += 0.001;
                    }
                    feedA += 0.001;
                    killB = 0.001;

                }
            }
        }
Exemplo n.º 2
0
        //runs the batch simulation
        public void RunBatchSimulation()
        {
            feedA = 0.001;
            killB = 0.001;
            double        diffA        = 0;
            double        diffB        = 0;
            IColourPicker colourScheme = new GrayScaleColours();

            for (int i = 0; i < 3; i++)
            {
                //set laplacian function and related diffusion rates
                if (i == 0)
                {
                    lapFunc = LaplacianFunctions.PerpendicularLaplacian;
                    diffA   = perpDiffA;
                    diffB   = PerpDiffB;
                }
                else if (i == 1)
                {
                    lapFunc = LaplacianFunctions.ConvolutionLaplacian;
                    diffA   = convDeltDiffA;
                    diffB   = convDeltDiffB;
                }
                else if (i == 2)
                {
                    lapFunc = LaplacianFunctions.DeltaMeansLaplacian;
                    diffA   = convDeltDiffA;
                    diffB   = convDeltDiffB;
                }

                //changes feed A until it reaches 0.099
                while (feedA <= 0.099)
                {
                    //changes kill b untill it reaches 0.099
                    while (killB <= 0.099)
                    {
                        //makes a new grid with those numbers
                        grid = new Grid(canvas, bounds, lapFunc, colourScheme, cellSize, gridSize, diffA, diffB, feedA, killB);
                        //runs throught the simulation for 5000 iterations - enough to become stable
                        for (int j = 0; j < numOfIterations; j++)
                        {
                            grid.GetCellsNextValues();
                            grid.UpdateCellsValues();
                        }
                        //once it has become stable draws to screen then saves the image
                        grid.DrawGrid();
                        formGraphics.DrawImage(pattern, 0, 0);
                        SaveImage();

                        killB += 0.001;
                    }
                    feedA += 0.001;
                    killB  = 0.001;
                }
            }
        }
Exemplo n.º 3
0
        //makes the colour scheme that is to be used
        public IColourPicker MakeColour(ColourChoices choice)
        {
            IColourPicker newColour = new GrayScaleColours();

            switch (choice)
            {
                case ColourChoices.GrayScale:
                    newColour = new GrayScaleColours();
                    break;
                case ColourChoices.Colour1:
                    newColour = new ColourScheme1();
                    break;
                case ColourChoices.Colour2:
                    newColour = new ColourScheme2();
                    break;
            }
            return newColour;
        }
Exemplo n.º 4
0
        //makes the colour scheme that is to be used
        public IColourPicker MakeColour(ColourChoices choice)
        {
            IColourPicker newColour = new GrayScaleColours();

            switch (choice)
            {
            case ColourChoices.GrayScale:
                newColour = new GrayScaleColours();
                break;

            case ColourChoices.Colour1:
                newColour = new ColourScheme1();
                break;

            case ColourChoices.Colour2:
                newColour = new ColourScheme2();
                break;
            }
            return(newColour);
        }