示例#1
0
        public CellVisualiser(IRenderer renderer)
        {
            m_renderer = renderer;
            m_scene    = m_renderer.GetNewScene();

            m_positions = new List <List <Vector3d> >();

            m_random = new Random();

            m_renderArrays           = new RenderArrays3d();
            m_renderArrays.Positions = new List <Vector3d>();
            m_renderArrays.Colours   = new List <Colour>();

            m_scene.CreateCamera();
            m_scene.SetCurrentCamera(0);

            m_scene.RenderArrays3d.Add(m_renderArrays);

            m_baseColours = new Colour[11];

            m_baseColours[00] = new Colour()
            {
                R = 1.0f, G = 0.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[01] = new Colour()
            {
                R = 0.0f, G = 1.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[02] = new Colour()
            {
                R = 0.0f, G = 0.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[03] = new Colour()
            {
                R = 1.0f, G = 1.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[04] = new Colour()
            {
                R = 0.0f, G = 1.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[05] = new Colour()
            {
                R = 1.0f, G = 0.5f, B = 0.5f, A = 0.0f
            };
            m_baseColours[06] = new Colour()
            {
                R = 0.5f, G = 1.0f, B = 0.5f, A = 0.0f
            };
            m_baseColours[07] = new Colour()
            {
                R = 0.5f, G = 0.5f, B = 1.0f, A = 0.0f
            };
            m_baseColours[08] = new Colour()
            {
                R = 1.0f, G = 1.0f, B = 0.5f, A = 0.0f
            };
            m_baseColours[09] = new Colour()
            {
                R = 0.5f, G = 1.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[10] = new Colour()
            {
                R = 1.0f, G = 0.5f, B = 1.0f, A = 0.0f
            };

            LoadFile("C:/Users/Tim/Desktop/UbuntuScratch/chasteOutput/OverlappingSpheres/results_from_time_0/results.viznodes");
        }
        const float MStageRequiredTimesteps = 1238.4f / SecondsPerTimestep; // 20.64 minutes (from Potten92)

        public CryptCC(IRenderer renderer, string filename, float averageGrowthTimeSeconds, float attachmentForce)
        {
            string extension = System.IO.Path.GetExtension(filename);

            filename = System.IO.Path.GetDirectoryName(filename) + @"\" + System.IO.Path.GetFileNameWithoutExtension(filename);

            outfile    = new System.IO.StreamWriter(@"C:\Users\Tim\Desktop\" + filename + "_CC" + (averageGrowthTimeSeconds / 3600).ToString() + "hrs_AF" + attachmentForce.ToString() + extension, false);
            m_renderer = renderer;
            m_scene    = m_renderer.GetNewScene();

            m_averageGrowthTimeSeconds     = averageGrowthTimeSeconds;
            m_offMembraneRestorationFactor = attachmentForce;

            m_random    = new Random(DateTime.Now.Millisecond);
            m_normalRNG = new NormalDistributionRNG(m_random, m_averageGrowthTimesteps, GrowthTimestepsStandardDeviation);

            m_cells = new CellArrayCC();

            m_renderArraysAnoikis           = new RenderArrays3d();
            m_renderArraysAnoikis.Positions = new List <Vector3d>();
            m_renderArraysAnoikis.Colours   = new List <Colour>();
            m_renderArraysAnoikis.Visible   = new List <bool>();

            m_renderArraysCells           = new RenderArrays3d();
            m_renderArraysCells.Positions = m_cells.Positions;
            m_renderArraysCells.Colours   = m_cells.Colours;
            m_renderArraysCells.Visible   = m_cells.Active;

            m_scene.CreateCamera();
            m_scene.SetCurrentCamera(0);

            m_scene.RenderArrays3d.Add(m_renderArraysCells);

            m_baseColours  = new Colour[11];
            m_colourCounts = new int[11];

            m_baseColours[00] = new Colour()
            {
                R = 1.0f, G = 0.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[01] = new Colour()
            {
                R = 0.0f, G = 1.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[02] = new Colour()
            {
                R = 0.0f, G = 0.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[03] = new Colour()
            {
                R = 1.0f, G = 1.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[04] = new Colour()
            {
                R = 0.0f, G = 1.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[05] = new Colour()
            {
                R = 1.0f, G = 0.5f, B = 0.5f, A = 0.0f
            };
            m_baseColours[06] = new Colour()
            {
                R = 0.5f, G = 1.0f, B = 0.5f, A = 0.0f
            };
            m_baseColours[07] = new Colour()
            {
                R = 0.5f, G = 0.5f, B = 1.0f, A = 0.0f
            };
            m_baseColours[08] = new Colour()
            {
                R = 1.0f, G = 1.0f, B = 0.5f, A = 0.0f
            };
            m_baseColours[09] = new Colour()
            {
                R = 0.5f, G = 1.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[10] = new Colour()
            {
                R = 1.0f, G = 0.5f, B = 1.0f, A = 0.0f
            };

            m_crypts = new CryptArrayCC();

            float centeringOffset = m_fieldHalfSize - 2000f;

            for (int y = 0; y < m_numCryptsPerSide; y++)
            {
                for (int x = 0; x < m_numCryptsPerSide; x++)
                {
                    int colourIndex = (x + y * m_numCryptsPerSide) % m_baseColours.Count();

                    PopulateCrypt(x, y, colourIndex, centeringOffset);

                    m_crypts.Add(new Vector3d(x * m_initialCryptSeparation - centeringOffset, 0.0f, y * m_initialCryptSeparation - centeringOffset));
                }
            }

            m_grid = new UniformIndexGrid(m_numCryptsPerSide * 2, 30, m_numCryptsPerSide * 2, new Vector3d(2.0f * (m_colonBoundary.X + 100.0f), -1.0f * (CryptHeight + 500.0f), 2.0f * (m_colonBoundary.Y + 100.0f)), new Vector3d(-1.0f * (m_colonBoundary.X + 10.0f), 0.0f, -1.0f * (m_colonBoundary.Y + 10.0f)));
        }
示例#3
0
        public World(IRenderer renderer)
        {
            m_baseColours = new Colour[12];

            m_baseColours[00] = new Colour()
            {
                R = 1.0f, G = 0.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[01] = new Colour()
            {
                R = 0.0f, G = 1.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[02] = new Colour()
            {
                R = 0.0f, G = 0.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[03] = new Colour()
            {
                R = 1.0f, G = 1.0f, B = 0.0f, A = 0.0f
            };
            m_baseColours[04] = new Colour()
            {
                R = 0.0f, G = 1.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[05] = new Colour()
            {
                R = 1.0f, G = 0.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[06] = new Colour()
            {
                R = 1.0f, G = 0.5f, B = 0.5f, A = 0.0f
            };
            m_baseColours[07] = new Colour()
            {
                R = 0.5f, G = 1.0f, B = 0.5f, A = 0.0f
            };
            m_baseColours[08] = new Colour()
            {
                R = 0.5f, G = 0.5f, B = 1.0f, A = 0.0f
            };
            m_baseColours[09] = new Colour()
            {
                R = 1.0f, G = 1.0f, B = 0.5f, A = 0.0f
            };
            m_baseColours[10] = new Colour()
            {
                R = 0.5f, G = 1.0f, B = 1.0f, A = 0.0f
            };
            m_baseColours[11] = new Colour()
            {
                R = 1.0f, G = 0.5f, B = 1.0f, A = 0.0f
            };

            m_random = new Random();

            m_renderer = renderer;

            m_scene = m_renderer.GetNewScene();

            m_scene.CreateCamera();
            m_scene.SetCurrentCamera(0);

            m_basisRenderArrays  = new RenderArrays();
            m_springRenderArrays = new RenderArrays();
            m_bBoxRenderArrays   = new RenderArrays();
            m_renderArrays       = new RenderArrays();

            m_blobs = new BlobArrays();
            m_directionalSprings = new DirectionalSpringArray();
            m_collisions         = new List <Tuple <int, int> >();
            m_cellData           = new CellDataArrays();
            m_BBoxTree           = new BBoxTree();
            m_springs            = new SpringArray();

            m_renderArrays.Positions = m_blobs.Positions;
            m_renderArrays.Colours   = m_blobs.Colours;

            m_bBoxRenderArrays.Colours.Add(m_baseColours[0]);
            m_bBoxRenderArrays.Positions.Add(new Vector2d());

            //InitVisualisationTest();

            for (int i = -0; i < 1; i++)
            {
                bool grow = i == 0 ? true : false;
                InitCell(new Vector2d()
                {
                    X = (float)(250.0f * i + 150.0f), Y = 0
                }, i + 4, grow);
            }
            //InitCell(new Vector2d() { X = -100.0f, Y = 0.0f }, 0, true);

            m_scene.RenderArrays.Add(m_renderArrays);
            //m_scene.RenderArrays.Add(m_bBoxRenderArrays);
            m_scene.RenderArrays.Add(m_springRenderArrays);
            m_scene.RenderArrays.Add(m_basisRenderArrays);

            m_basisRenderArrays.Positions.Add(new Vector2d());
            m_basisRenderArrays.Colours.Add(m_baseColours[5]);
            m_basisRenderArrays.Positions.Add(new Vector2d());
            m_basisRenderArrays.Colours.Add(m_baseColours[5]);
        }