/// <summary> /// Change current cell with Moore rules /// </summary> /// <returns></returns> protected bool Moore(Cell c) { CounterReturn cr = this.MooreMostCommonCell(c); if (cr != null) { this.grid.CurrentCell.NewID = cr.ID; return true; } return false; }
public void AddCell(Cell cell) { // 0 - null, 1 - inclusion // Selected grains can not grow if ( cell.ID > 1 && !cell.Selected ) { if ( !this.counter.ContainsKey(cell.ID) ) { this.counter[cell.ID] = 0; } ++this.counter[cell.ID]; } }
private bool IsNotRecrystalizedCellOnBoundary(Cell cell) { return cell.ID > 1 && !cell.Recrystalized && cell.MoorNeighborhood.Count(i => i.ID != cell.ID && !i.Recrystalized) > 0; }
private bool IsNotRecrystalizedCellWithRecrystalizedNeighboor(Cell cell) { return cell.ID > 1 && !cell.Recrystalized && cell.MoorNeighborhood.Count(i => i.Recrystalized) > 0; }
/// <summary> /// Look for most common cell of current cell Moore neighborhood /// </summary> /// <returns>Most common cell with count or null</returns> protected CounterReturn MooreMostCommonCell(Cell c) { Counter counter = new Counter(); counter.AddCells(c.MoorNeighborhood); return counter.MostCommonID; }
private bool IsCorrectRandomCell(Cell cell) { return cell.ID > 1 && !cell.Selected && cell.MoorNeighborhood.Where(i => i.ID != cell.ID && !i.Selected).Count() > 0; }