예제 #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);
        }
예제 #2
0
        public GridAxisIterator2D(EGridAxis2D axis, GridCoord2D startCoord, GridSize2D gridSize)
        {
            Axis       = axis;
            StartIndex = startCoord.Index;

            GridIterator2D iterator = new GridIterator2D(gridSize);

            Step = iterator.Get(axis);
        }
예제 #3
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);
        }
예제 #4
0
 public DataGrid2D(GridSize2D size)
 {
     Size     = size;
     Iterator = new GridIterator2D(size);
     Cells    = new TCell[size.Length];
 }