Class PointyTriGrid<TCell>
A grid of triangles in the pointy orientation. All triangles have one vertical edge.
[Version(1, 0, 0)]
[Serializable]
public class PointyTriGrid<TCell> : AbstractSplicedGrid<TCell, PointyTriPoint, FlatHexPoint>, IGrid<TCell, PointyTriPoint>, IGrid<PointyTriPoint>, IGridSpace<PointyTriPoint>, IEnumerable<PointyTriPoint>, IEnumerable, ISupportsVertexGrid<FlatHexPoint>, ISupportsEdgeGrid<FlatRhombPoint>
Type Parameters
TCell
- Inheritance
-
PointyTriGrid<TCell>
- Implements
-
IGrid<TCell, PointyTriPoint>
- Inherited Members
- Extension Methods
Constructors
PointyTriGrid(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 PointyTriGrid(int width, int height)
Parameters
PointyTriGrid(int, int, Func<PointyTriPoint, 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 PointyTriGrid(int width, int height, Func<PointyTriPoint, bool> isInside)
Parameters
width
intheight
intisInside
Func<PointyTriPoint, bool>
PointyTriGrid(int, int, Func<PointyTriPoint, bool>, FlatHexPoint)
public PointyTriGrid(int width, int height, Func<PointyTriPoint, bool> isInside, FlatHexPoint offset)
Parameters
width
intheight
intisInside
Func<PointyTriPoint, bool>offset
FlatHexPoint
PointyTriGrid(int, int, Func<PointyTriPoint, bool>, PointyTriPoint)
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 PointyTriGrid(int width, int height, Func<PointyTriPoint, bool> isInside, PointyTriPoint offset)
Parameters
width
intheight
intisInside
Func<PointyTriPoint, bool>offset
PointyTriPoint
PointyTriGrid(int, int, Func<PointyTriPoint, bool>, Func<PointyTriPoint, PointyTriPoint>, Func<PointyTriPoint, PointyTriPoint>)
public PointyTriGrid(int width, int height, Func<PointyTriPoint, bool> isInside, Func<PointyTriPoint, PointyTriPoint> gridPointTransform, Func<PointyTriPoint, PointyTriPoint> inverseGridPointTransform)
Parameters
width
intheight
intisInside
Func<PointyTriPoint, bool>gridPointTransform
Func<PointyTriPoint, PointyTriPoint>inverseGridPointTransform
Func<PointyTriPoint, PointyTriPoint>
PointyTriGrid(int, int, Func<PointyTriPoint, bool>, Func<PointyTriPoint, PointyTriPoint>, Func<PointyTriPoint, PointyTriPoint>, IEnumerable<PointyTriPoint>[])
public PointyTriGrid(int width, int height, Func<PointyTriPoint, bool> isInside, Func<PointyTriPoint, PointyTriPoint> gridPointTransform, Func<PointyTriPoint, PointyTriPoint> inverseGridPointTransform, IEnumerable<PointyTriPoint>[] neighborDirections)
Parameters
width
intheight
intisInside
Func<PointyTriPoint, bool>gridPointTransform
Func<PointyTriPoint, PointyTriPoint>inverseGridPointTransform
Func<PointyTriPoint, PointyTriPoint>neighborDirections
IEnumerable<PointyTriPoint>[]
Properties
GridOrigin
Gives the Zero point as transform by this grids transforms.
protected override PointyTriPoint GridOrigin { get; }
Property Value
Methods
ArrayPointFromGridPoint(FlatHexPoint)
public static ArrayPoint ArrayPointFromGridPoint(FlatHexPoint point)
Parameters
point
FlatHexPoint
Returns
BeginShape()
Use this method to begin a shape building sequence.
public static PointyTriOp<TCell> BeginShape()
Returns
- PointyTriOp<TCell>
CalculateStorage(IEnumerable<PointyTriPoint>)
public static IntRect CalculateStorage(IEnumerable<PointyTriPoint> points)
Parameters
points
IEnumerable<PointyTriPoint>
Returns
CloneStructure<TNewCellType>()
Returns a grid in the same shape, but with contents in the new type.
public override IGrid<TNewCellType, PointyTriPoint> CloneStructure<TNewCellType>()
Returns
- IGrid<TNewCellType, PointyTriPoint>
Type Parameters
TNewCellType
Default(int, int)
public static PointyTriGrid<TCell> Default(int width, int height)
Parameters
Returns
- PointyTriGrid<TCell>
DefaultContains(PointyTriPoint, int, int)
public static bool DefaultContains(PointyTriPoint point, int width, int height)
Parameters
point
PointyTriPointwidth
intheight
int
Returns
FatRectangle(int, int)
public static PointyTriGrid<TCell> FatRectangle(int width, int height)
Parameters
Returns
- PointyTriGrid<TCell>
GridPointFromArrayPoint(ArrayPoint)
public static FlatHexPoint GridPointFromArrayPoint(ArrayPoint point)
Parameters
point
ArrayPoint
Returns
Hexagon(int)
public static PointyTriGrid<TCell> Hexagon(int side)
Parameters
side
int
Returns
- PointyTriGrid<TCell>
LeftTriangle(int)
public static PointyTriGrid<TCell> LeftTriangle(int side)
Parameters
side
int
Returns
- PointyTriGrid<TCell>
MakeEdgeGrid<TNewCell>()
Makes an edge grid for this grid.
public IGrid<TNewCell, FlatRhombPoint> MakeEdgeGrid<TNewCell>()
Returns
- IGrid<TNewCell, FlatRhombPoint>
Type Parameters
TNewCell
MakePoint(FlatHexPoint, int)
protected override PointyTriPoint MakePoint(FlatHexPoint basePoint, int index)
Parameters
basePoint
FlatHexPointindex
int
Returns
MakeUnderlyingGrid(int, int)
protected override IGrid<TCell[], FlatHexPoint> MakeUnderlyingGrid(int width, int height)
Parameters
Returns
- IGrid<TCell[], FlatHexPoint>
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, FlatHexPoint> MakeVertexGrid<TNewCell>()
Returns
- IGrid<TNewCell, FlatHexPoint>
Type Parameters
TNewCell
ParallelogramXY(int, int)
public static PointyTriGrid<TCell> ParallelogramXY(int width, int height)
Parameters
Returns
- PointyTriGrid<TCell>
ParallelogramXZ(int, int)
public static PointyTriGrid<TCell> ParallelogramXZ(int width, int height)
Parameters
Returns
- PointyTriGrid<TCell>
Rectangle(int, int)
public static PointyTriGrid<TCell> Rectangle(int width, int height)
Parameters
Returns
- PointyTriGrid<TCell>
RightTriangle(int)
public static PointyTriGrid<TCell> RightTriangle(int side)
Parameters
side
int
Returns
- PointyTriGrid<TCell>
Single()
public static PointyTriGrid<TCell> Single()
Returns
- PointyTriGrid<TCell>
SingleGroup()
public static PointyTriGrid<TCell> SingleGroup()
Returns
- PointyTriGrid<TCell>
Star(int)
public static PointyTriGrid<TCell> Star(int side)
Parameters
side
int
Returns
- PointyTriGrid<TCell>
ThinRectangle(int, int)
public static PointyTriGrid<TCell> ThinRectangle(int width, int height)
Parameters
Returns
- PointyTriGrid<TCell>
ToString()
public override string ToString()