Class FlatTriGrid<TCell>
A grid of triangles in the flat orientation. All triangles have one horizontal edge.
[Version(1, 0, 0)]
[Serializable]
public class FlatTriGrid<TCell> : AbstractSplicedGrid<TCell, FlatTriPoint, PointyHexPoint>, IGrid<TCell, FlatTriPoint>, IGrid<FlatTriPoint>, IGridSpace<FlatTriPoint>, IEnumerable<FlatTriPoint>, IEnumerable, ISupportsVertexGrid<PointyHexPoint>, ISupportsEdgeGrid<PointyRhombPoint>
Type Parameters
TCell
- Inheritance
-
FlatTriGrid<TCell>
- Implements
-
IGrid<TCell, FlatTriPoint>
- Inherited Members
- Extension Methods
Constructors
FlatTriGrid(int, int)
Construct a new grid in the default shape with the given width and height. No transformations are applied to the grid.
Normally, the static factory methods or shape building methods should be used to create grids. These constructors are provided for advanced usage.
public FlatTriGrid(int width, int height)
Parameters
FlatTriGrid(int, int, Func<FlatTriPoint, bool>)
Construct a new grid whose cells are determined by the given test function.
The test function should only return true for points within the bounds of the default shape.
No transformations are applied to the grid.
Normally, the static factory methods or shape building methods should be used to create grids. These constructors are provided for advanced usage.
public FlatTriGrid(int width, int height, Func<FlatTriPoint, bool> isInside)
Parameters
width
intheight
intisInside
Func<FlatTriPoint, bool>
FlatTriGrid(int, int, Func<FlatTriPoint, bool>, FlatTriPoint)
Construct a new grid whose cells are determined by the given test function.
The function should only return true for points within the bounds of the rectangle when the given transforms are applied to them.
Normally, the static factory methods or shape building methods should be used to create grids. These constructors are provided for advanced usage.
public FlatTriGrid(int width, int height, Func<FlatTriPoint, bool> isInside, FlatTriPoint offset)
Parameters
width
intheight
intisInside
Func<FlatTriPoint, bool>offset
FlatTriPoint
FlatTriGrid(int, int, Func<FlatTriPoint, bool>, PointyHexPoint)
public FlatTriGrid(int width, int height, Func<FlatTriPoint, bool> isInside, PointyHexPoint offset)
Parameters
width
intheight
intisInside
Func<FlatTriPoint, bool>offset
PointyHexPoint
FlatTriGrid(int, int, Func<FlatTriPoint, bool>, Func<FlatTriPoint, FlatTriPoint>, Func<FlatTriPoint, FlatTriPoint>)
public FlatTriGrid(int width, int height, Func<FlatTriPoint, bool> isInside, Func<FlatTriPoint, FlatTriPoint> gridPointTransform, Func<FlatTriPoint, FlatTriPoint> inverseGridPointTransform)
Parameters
width
intheight
intisInside
Func<FlatTriPoint, bool>gridPointTransform
Func<FlatTriPoint, FlatTriPoint>inverseGridPointTransform
Func<FlatTriPoint, FlatTriPoint>
FlatTriGrid(int, int, Func<FlatTriPoint, bool>, Func<FlatTriPoint, FlatTriPoint>, Func<FlatTriPoint, FlatTriPoint>, IEnumerable<FlatTriPoint>[])
public FlatTriGrid(int width, int height, Func<FlatTriPoint, bool> isInside, Func<FlatTriPoint, FlatTriPoint> gridPointTransform, Func<FlatTriPoint, FlatTriPoint> inverseGridPointTransform, IEnumerable<FlatTriPoint>[] neighborDirections)
Parameters
width
intheight
intisInside
Func<FlatTriPoint, bool>gridPointTransform
Func<FlatTriPoint, FlatTriPoint>inverseGridPointTransform
Func<FlatTriPoint, FlatTriPoint>neighborDirections
IEnumerable<FlatTriPoint>[]
Properties
GridOrigin
Gives the Zero point as transform by this grids transforms.
protected override FlatTriPoint GridOrigin { get; }
Property Value
Methods
ArrayPointFromGridPoint(PointyHexPoint)
public static ArrayPoint ArrayPointFromGridPoint(PointyHexPoint point)
Parameters
point
PointyHexPoint
Returns
BeginShape()
Use this method to begin a shape building sequence.
public static FlatTriOp<TCell> BeginShape()
Returns
- FlatTriOp<TCell>
CalculateStorage(IEnumerable<FlatTriPoint>)
public static IntRect CalculateStorage(IEnumerable<FlatTriPoint> points)
Parameters
points
IEnumerable<FlatTriPoint>
Returns
CloneStructure<TNewCellType>()
Returns a grid in the same shape, but with contents in the new type.
public override IGrid<TNewCellType, FlatTriPoint> CloneStructure<TNewCellType>()
Returns
- IGrid<TNewCellType, FlatTriPoint>
Type Parameters
TNewCellType
Default(int, int)
public static FlatTriGrid<TCell> Default(int width, int height)
Parameters
Returns
- FlatTriGrid<TCell>
DefaultContains(FlatTriPoint, int, int)
public static bool DefaultContains(FlatTriPoint point, int width, int height)
Parameters
point
FlatTriPointwidth
intheight
int
Returns
DownTriangle(int)
public static FlatTriGrid<TCell> DownTriangle(int side)
Parameters
side
int
Returns
- FlatTriGrid<TCell>
GridPointFromArrayPoint(ArrayPoint)
public static PointyHexPoint GridPointFromArrayPoint(ArrayPoint point)
Parameters
point
ArrayPoint
Returns
Hexagon(int)
public static FlatTriGrid<TCell> Hexagon(int side)
Parameters
side
int
Returns
- FlatTriGrid<TCell>
MakeEdgeGrid<TNewCell>()
Makes an edge grid for this grid.
public IGrid<TNewCell, PointyRhombPoint> MakeEdgeGrid<TNewCell>()
Returns
- IGrid<TNewCell, PointyRhombPoint>
Type Parameters
TNewCell
MakePoint(PointyHexPoint, int)
protected override FlatTriPoint MakePoint(PointyHexPoint basePoint, int index)
Parameters
basePoint
PointyHexPointindex
int
Returns
MakeUnderlyingGrid(int, int)
protected override IGrid<TCell[], PointyHexPoint> MakeUnderlyingGrid(int width, int height)
Parameters
Returns
- IGrid<TCell[], PointyHexPoint>
MakeVertexGrid<TNewCell>()
Makes a grid that corresponds to the vertices of this grid.
If point is inside this grid, then all of point.GetVertices() are in the grid returned by this method.
public IGrid<TNewCell, PointyHexPoint> MakeVertexGrid<TNewCell>()
Returns
- IGrid<TNewCell, PointyHexPoint>
Type Parameters
TNewCell
ParallelogramXY(int, int)
public static FlatTriGrid<TCell> ParallelogramXY(int width, int height)
Parameters
Returns
- FlatTriGrid<TCell>
ParallelogramXZ(int, int)
public static FlatTriGrid<TCell> ParallelogramXZ(int width, int height)
Parameters
Returns
- FlatTriGrid<TCell>
Rectangle(int, int)
public static FlatTriGrid<TCell> Rectangle(int width, int height)
Parameters
Returns
- FlatTriGrid<TCell>
Single()
public static FlatTriGrid<TCell> Single()
Returns
- FlatTriGrid<TCell>
SingleGroup()
public static FlatTriGrid<TCell> SingleGroup()
Returns
- FlatTriGrid<TCell>
Star(int)
public static FlatTriGrid<TCell> Star(int side)
Parameters
side
int
Returns
- FlatTriGrid<TCell>
ToString()
public override string ToString()
Returns
UpTriangle(int)
public static FlatTriGrid<TCell> UpTriangle(int side)
Parameters
side
int
Returns
- FlatTriGrid<TCell>