Ejemplo n.º 1
0
        internal void SetCellAsActive(int x, int y, int currentNucleonId)
        {
            CurrentGrid.Cells[x, y].ChangeState(1);
            CurrentGrid.Cells[x, y].Id = currentNucleonId;
            CurrentGrid.Cells[x, y].OriginPosition.Set(x, y);
            CurrentGrid.Cells[x, y].Time = 0;

            OriginGrains.Add(CurrentGrid.Cells[x, y].CurrentPosition);
        }
Ejemplo n.º 2
0
        internal int AddRectangleCells(int numberOfActiveCells, double rotation, double firstRatio, double secondRatio)
        {
            List <Point> emptyCellPoints = new List <Point>();

            emptyCellPoints = GetEmptyCells();
            Random r = new Random();

            emptyCellPoints = emptyCellPoints.OrderBy(e => r.Next()).Take(numberOfActiveCells).ToList();

            foreach (Point p in emptyCellPoints)
            {
                SetCellAsActive(p.X, p.Y, OriginGrains.Count);
                CurrentGrid.Cells[p.X, p.Y].SetAsRectangleOrigin(rotation, firstRatio, secondRatio);
                OriginGrains.Add(CurrentGrid.Cells[p.X, p.Y].CurrentPosition);
                FrontalSolverEngine.FrontPoints.Add(p);
            }

            return(emptyCellPoints.Count);
        }
Ejemplo n.º 3
0
        internal int AddCircleCells(int numberOfActiveCells, List <Point> emptyCellPoints = null)
        {
            if (emptyCellPoints == null)
            {
                emptyCellPoints = GetEmptyCells();
            }

            Random       r          = new Random();
            List <Point> cellPoints = emptyCellPoints.OrderBy(e => r.Next()).Take(numberOfActiveCells).ToList();


            foreach (Point p in cellPoints)
            {
                SetCellAsActive(p.X, p.Y, OriginGrains.Count);
                CurrentGrid.Cells[p.X, p.Y].SetAsCircleOrigin();
                OriginGrains.Add(CurrentGrid.Cells[p.X, p.Y].CurrentPosition);
                FrontalSolverEngine.FrontPoints.Add(p);
                emptyCellPoints.Remove(p);
            }

            return(cellPoints.Count);
        }
Ejemplo n.º 4
0
        internal int AddRandomRectangleCells(int numberOfActiveCells, List <Point> emptyCellPoints = null)
        {
            if (emptyCellPoints == null)
            {
                emptyCellPoints = GetEmptyCells();
            }
            Random       r          = new Random();
            List <Point> cellPoints = emptyCellPoints.OrderBy(e => r.Next()).Take(numberOfActiveCells).ToList();


            foreach (Point p in cellPoints)
            {
                var Rotation    = r.NextDouble() * 90.0;
                var FirstRatio  = r.NextDouble() * 10;
                var SecondRatio = r.NextDouble() * 10;
                SetCellAsActive(p.X, p.Y, OriginGrains.Count);
                CurrentGrid.Cells[p.X, p.Y].SetAsRectangleOrigin(Rotation, FirstRatio, SecondRatio);
                OriginGrains.Add(CurrentGrid.Cells[p.X, p.Y].CurrentPosition);
                FrontalSolverEngine.FrontPoints.Add(p);
                emptyCellPoints.Remove(p);
            }

            return(cellPoints.Count);
        }