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); }
public void Set(TCell cell, GridCoord2D coord) { if (Cells.Length <= coord.Index) { throw new System.Exception(); } Cells[coord.Index] = cell; }
public GridAxisIterator2D(EGridAxis2D axis, GridCoord2D startCoord, GridSize2D gridSize) { Axis = axis; StartIndex = startCoord.Index; GridIterator2D iterator = new GridIterator2D(gridSize); Step = iterator.Get(axis); }
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); }
/// <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; }
public void Set(TCell cell, GridPoint2D point) { GridCoord2D coord = new GridCoord2D(Size, point); Set(cell, coord); }
public void Set(TCell cell, int x, int y) { GridCoord2D coord = new GridCoord2D(Size, x, y); Set(cell, coord); }
public TCell Get(GridCoord2D coord) { return(Cells[coord.Index]); }
public TCell Get(GridPoint2D point) { GridCoord2D coord = new GridCoord2D(Size, point); return(Get(coord)); }
public TCell Get(int x, int y) { GridCoord2D coord = new GridCoord2D(Size, x, y); return(Get(coord)); }