Example #1
0
        public GridCoord3D(GridSize3D size, int index)
        {
            Index = index;

            int x = (index % size.X);

            index /= size.X;
            int y = (index % size.Y);

            index /= size.Y;
            int z = index;

            Point = new GridPoint3D(x, y, z);
        }
Example #2
0
        public GridCoord3D Set(GridSize3D size, EGridAxis3D axis, int value)
        {
            switch (axis)
            {
            case EGridAxis3D.X:
                return(new GridCoord3D(size, value, Point.Y, Point.Z));

            case EGridAxis3D.Y:
                return(new GridCoord3D(size, Point.X, value, Point.Z));

            case EGridAxis3D.Z:
                return(new GridCoord3D(size, Point.X, Point.Y, value));

            default:
                throw new NotImplementedException();
            }
        }
Example #3
0
        public static GridCoord3D GetIterator(this EGridAxis3D axis, GridSize3D size, int step = 1, bool negative = false)
        {
            int direction = (negative ? -step : step);

            switch (axis)
            {
            case EGridAxis3D.X:
                return(new GridCoord3D(size, direction, 0, 0));

            case EGridAxis3D.Y:
                return(new GridCoord3D(size, 0, direction, 0));

            case EGridAxis3D.Z:
                return(new GridCoord3D(size, 0, 0, direction));

            default:
                throw new NotImplementedException();
            }
        }
Example #4
0
        public static GridCoord3D Create(GridSize3D size, GridAxes3D axes, int a, int b, int c)
        {
            GridPoint3D point = GridPoint3D.Create(axes, a, b, c);

            return(new GridCoord3D(size, point));
        }
Example #5
0
 public GridCoord3D(GridSize3D size, GridPoint3D point)
 {
     Point = point;
     Index = (point.Z * size.X * size.Y) + (point.Y * size.X) + point.X;
 }
Example #6
0
 public GridCoord3D(GridSize3D size, int x, int y, int z)
     : this(size, new GridPoint3D(x, y, z))
 {
 }
Example #7
0
 public GridBounds3D(GridSize3D size)
 {
     Min = new GridPoint3D(0, 0, 0);
     Max = new GridPoint3D(size.X, size.Y, size.Z);
 }
Example #8
0
 public GridIterator3D(GridSize3D size)
 {
     X = 1;
     Y = size.X;
     Z = size.X * size.Y;
 }