コード例 #1
0
        public GridCoord2D(GridSize2D size, int index)
        {
            Index = index;

            int x = (index % size.X);

            index /= size.X;
            int y = index;

            Point = new GridPoint2D(x, y);
        }
コード例 #2
0
        public GridCoord2D Set(GridSize2D size, EGridAxis2D axis, int value)
        {
            switch (axis)
            {
            case EGridAxis2D.X:
                return(new GridCoord2D(size, value, Point.Y));

            case EGridAxis2D.Y:
                return(new GridCoord2D(size, Point.X, value));

            default:
                throw new NotImplementedException();
            }
        }
コード例 #3
0
ファイル: GridBounds2D.cs プロジェクト: LukaszKr/Common
 public GridBounds2D(GridSize2D size)
 {
     Min = new GridPoint2D(0, 0);
     Max = new GridPoint2D(size.X, size.Y);
 }
コード例 #4
0
ファイル: GridIterator2D.cs プロジェクト: LukaszKr/Common
 public GridIterator2D(GridSize2D size)
 {
     X = 1;
     Y = size.X;
 }
コード例 #5
0
        public static GridCoord2D Create(GridSize2D size, GridAxes2D axes, int a, int b)
        {
            GridPoint2D point = GridPoint2D.Create(axes, a, b);

            return(new GridCoord2D(size, point));
        }
コード例 #6
0
 public GridCoord2D(GridSize2D size, GridPoint2D point)
 {
     Point = point;
     Index = (point.Y * size.X) + point.X;
 }
コード例 #7
0
 public GridCoord2D(GridSize2D size, int x, int y)
     : this(size, new GridPoint2D(x, y))
 {
 }