コード例 #1
0
ファイル: Coord2DTests.cs プロジェクト: LukaszKr/Common
        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
ファイル: Coord2DTests.cs プロジェクト: LukaszKr/Common
        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
ファイル: DataGrid2D.cs プロジェクト: LukaszKr/Common
 public DataGrid2D(GridSize2D size)
 {
     Size     = size;
     Iterator = new GridIterator2D(size);
     Cells    = new TCell[size.Length];
 }