Class CairoGrid<TCell>
A CiaroGrid is a grid where all the cells are pentagons (so each cell has five neighbors). See http://en.wikipedia.org/wiki/Cairo_pentagonal_tiling.
[Version(1, 2, 0)]
public class CairoGrid<TCell> : AbstractSplicedGrid<TCell, CairoPoint, PointyHexPoint>, IGrid<TCell, CairoPoint>, IGrid<CairoPoint>, IGridSpace<CairoPoint>, IEnumerable<CairoPoint>, IEnumerable
Type Parameters
TCell
- Inheritance
-
CairoGrid<TCell>
- Implements
-
IGrid<TCell, CairoPoint>
- Inherited Members
- Extension Methods
Constructors
CairoGrid(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 CairoGrid(int width, int height)
Parameters
CairoGrid(int, int, Func<CairoPoint, 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 CairoGrid(int width, int height, Func<CairoPoint, bool> isInside)
Parameters
widthintheightintisInsideFunc<CairoPoint, bool>
CairoGrid(int, int, Func<CairoPoint, bool>, CairoPoint)
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 CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, CairoPoint offset)
Parameters
widthintheightintisInsideFunc<CairoPoint, bool>offsetCairoPoint
CairoGrid(int, int, Func<CairoPoint, bool>, PointyHexPoint)
public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, PointyHexPoint offset)
Parameters
widthintheightintisInsideFunc<CairoPoint, bool>offsetPointyHexPoint
CairoGrid(int, int, Func<CairoPoint, bool>, Func<CairoPoint, CairoPoint>, Func<CairoPoint, CairoPoint>)
public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, Func<CairoPoint, CairoPoint> gridPointTransform, Func<CairoPoint, CairoPoint> inverseGridPointTransform)
Parameters
widthintheightintisInsideFunc<CairoPoint, bool>gridPointTransformFunc<CairoPoint, CairoPoint>inverseGridPointTransformFunc<CairoPoint, CairoPoint>
CairoGrid(int, int, Func<CairoPoint, bool>, Func<CairoPoint, CairoPoint>, Func<CairoPoint, CairoPoint>, IEnumerable<CairoPoint>[])
public CairoGrid(int width, int height, Func<CairoPoint, bool> isInside, Func<CairoPoint, CairoPoint> gridPointTransform, Func<CairoPoint, CairoPoint> inverseGridPointTransform, IEnumerable<CairoPoint>[] neighborDirections)
Parameters
widthintheightintisInsideFunc<CairoPoint, bool>gridPointTransformFunc<CairoPoint, CairoPoint>inverseGridPointTransformFunc<CairoPoint, CairoPoint>neighborDirectionsIEnumerable<CairoPoint>[]
Properties
GridOrigin
Gives the Zero point as transform by this grids transforms.
protected override CairoPoint GridOrigin { get; }
Property Value
Methods
ArrayPointFromGridPoint(PointyHexPoint)
public static ArrayPoint ArrayPointFromGridPoint(PointyHexPoint point)
Parameters
pointPointyHexPoint
Returns
BeginShape()
Use this method to begin a shape building sequence.
public static CairoOp<TCell> BeginShape()
Returns
- CairoOp<TCell>
CalculateStorage(IEnumerable<CairoPoint>)
public static IntRect CalculateStorage(IEnumerable<CairoPoint> points)
Parameters
pointsIEnumerable<CairoPoint>
Returns
CloneStructure<TNewCellType>()
Returns a grid in the same shape, but with contents in the new type.
public override IGrid<TNewCellType, CairoPoint> CloneStructure<TNewCellType>()
Returns
- IGrid<TNewCellType, CairoPoint>
Type Parameters
TNewCellType
Default(int, int)
public static CairoGrid<TCell> Default(int width, int height)
Parameters
Returns
- CairoGrid<TCell>
DefaultContains(CairoPoint, int, int)
public static bool DefaultContains(CairoPoint point, int width, int height)
Parameters
pointCairoPointwidthintheightint
Returns
FatRectangle(int, int)
public static CairoGrid<TCell> FatRectangle(int width, int height)
Parameters
Returns
- CairoGrid<TCell>
GridPointFromArrayPoint(ArrayPoint)
public static PointyHexPoint GridPointFromArrayPoint(ArrayPoint point)
Parameters
pointArrayPoint
Returns
Hexagon(int)
public static CairoGrid<TCell> Hexagon(int side)
Parameters
sideint
Returns
- CairoGrid<TCell>
MakePoint(PointyHexPoint, int)
protected override CairoPoint MakePoint(PointyHexPoint basePoint, int index)
Parameters
basePointPointyHexPointindexint
Returns
MakeUnderlyingGrid(int, int)
protected override IGrid<TCell[], PointyHexPoint> MakeUnderlyingGrid(int width, int height)
Parameters
Returns
- IGrid<TCell[], PointyHexPoint>
Parallelogram(int, int)
public static CairoGrid<TCell> Parallelogram(int width, int height)
Parameters
Returns
- CairoGrid<TCell>
Rectangle(int, int)
public static CairoGrid<TCell> Rectangle(int width, int height)
Parameters
Returns
- CairoGrid<TCell>
Single()
public static CairoGrid<TCell> Single()
Returns
- CairoGrid<TCell>
SingleGroup()
public static CairoGrid<TCell> SingleGroup()
Returns
- CairoGrid<TCell>
ThinRectangle(int, int)
public static CairoGrid<TCell> ThinRectangle(int width, int height)
Parameters
Returns
- CairoGrid<TCell>
ToString()
public override string ToString()