Esempio n. 1
0
        private void AssertIndexCalculation(GridSize2D gridSize, int x, int y)
        {
            GridCoord2D coord = new GridCoord2D(gridSize, x, y);
            GridCoord2D index = new GridCoord2D(gridSize, coord.Index);

            AssertPoint(coord.Point, index.Point.X, index.Point.Y);
        }
Esempio n. 2
0
 public void Set(TCell cell, GridCoord2D coord)
 {
     if (Cells.Length <= coord.Index)
     {
         throw new System.Exception();
     }
     Cells[coord.Index] = cell;
 }
Esempio n. 3
0
        public GridAxisIterator2D(EGridAxis2D axis, GridCoord2D startCoord, GridSize2D gridSize)
        {
            Axis       = axis;
            StartIndex = startCoord.Index;

            GridIterator2D iterator = new GridIterator2D(gridSize);

            Step = iterator.Get(axis);
        }
Esempio n. 4
0
        public void GridTraversal()
        {
            GridSize2D     size      = new GridSize2D(5, 6);
            GridCoord2D    coord     = new GridCoord2D(size, 3, 3);
            GridIterator2D traversal = new GridIterator2D(size);

            GridCoord2D changed = new GridCoord2D(size, coord.Index + traversal.Y);

            AssertPoint(changed.Point, 3, 4);
            changed = new GridCoord2D(size, coord.Index - traversal.Y);
            AssertPoint(changed.Point, 3, 2);

            changed = new GridCoord2D(size, coord.Index + traversal.X);
            AssertPoint(changed.Point, 4, 3);
            changed = new GridCoord2D(size, coord.Index - traversal.X);
            AssertPoint(changed.Point, 2, 3);
        }
Esempio n. 5
0
 /// <summary>
 /// Determines if 2 points are equal by comparing their X and Y values
 /// </summary>
 /// <param name="point">The point to compare</param>
 /// <returns></returns>
 public bool Equals(GridCoord2D point)
 {
     return this == point;
 }
Esempio n. 6
0
        public void Set(TCell cell, GridPoint2D point)
        {
            GridCoord2D coord = new GridCoord2D(Size, point);

            Set(cell, coord);
        }
Esempio n. 7
0
        public void Set(TCell cell, int x, int y)
        {
            GridCoord2D coord = new GridCoord2D(Size, x, y);

            Set(cell, coord);
        }
Esempio n. 8
0
 public TCell Get(GridCoord2D coord)
 {
     return(Cells[coord.Index]);
 }
Esempio n. 9
0
        public TCell Get(GridPoint2D point)
        {
            GridCoord2D coord = new GridCoord2D(Size, point);

            return(Get(coord));
        }
Esempio n. 10
0
        public TCell Get(int x, int y)
        {
            GridCoord2D coord = new GridCoord2D(Size, x, y);

            return(Get(coord));
        }