Class PointyHexPoint
Provides constants and methods for working with points in pointy hex grids.
public static class PointyHexPoint
- Inheritance
-
PointyHexPoint
- Inherited Members
Fields
- Directions
The list of the six cardinal directions of a hex grid, two directions for each axis.
- East
The grid point to the east of the origin, that is, the point (1, 0).
- NorthEast
The grid point to the north-east of the origin, that is, the point (0, 1).
- NorthWest
The grid point to the north-west of the origin, that is, the point (-1, 1).
- OrthogonalLines
A list of the three cardinal lines of a hex grid, that is, the axes.
- RawSpaceMapTransform
The raw space map transform for hex grids. This should be used with a scale matrix with values (width, height, 1) to get cells with the desired with and height.
- SouthEast
The grid point to the south-east of the origin, that is, the point (1, -1).
- SouthWest
The grid point to the south-west of the origin, that is, the point (0, -1).
- SpaceMapTransform
The default space map transform for hex grids. This should be used with a uniform scale matrix (with the value of the cell width) to get a regular hex grid.
- Sqrt3
The square root of 3, which is often used in raw math calculations involving hex grids.
- West
The grid point to the west of the origin, that is, the point (-1, 0).
Methods
- DownTriPseudoNorm(GridPoint2)
Returns the down-triangle pseudonorm of the given point.
- DownTriPseudoNorm(Vector2)
Returns the down-triangle pseudonorm of the given point.
- EuclideanNorm(GridPoint2)
Returns the Euclidean norm of this point, treating it as lying in a (normalized) hex grid.
- EuclideanNorm(Vector2)
Returns the Euclidean norm of this point, treating it as lying in a (normalized) hex grid.
- GetOrthogonalNeighbors(GridPoint2)
Gets the "orthogonal" neighbors for the given point, that is, the six neighbors in the cardinal directions.
- GetSpiralIterator(IImplicitShape<GridPoint2>, GridPoint2, int)
Get's an enumerable of shape points in a spiral outwards from a given point, assuming the points are coordinates of a hex grid.
- HexNorm(GridPoint2)
Returns the hex norm of a point, defined by how many edges you have to cross in a hex grid moving from the origin to the point.
- HexNorm(Vector2)
Returns the hex norm of a point, defined by how many edges you have to cross in a hex grid moving from the origin to the point.
- ManhattanNorm(GridPoint2)
Returns the Hex-Manhattan norm of a point, defined by how many edges you have to cross in a hex grid moving from the origin to the point.
- ManhattanNorm(Vector2)
Returns the Hex-Manhattan norm of a point, defined by how many edges you have to cross in a hex grid moving from the origin to the point.
- ReflectAboutX(GridPoint2)
Reflects the given point about the X-axis.
- ReflectAboutY(GridPoint2)
Reflects the given point about the Y-axis.
- Rotate120(GridPoint2)
Rotates the given point by 120 degrees counter clock-wise.
- Rotate180(GridPoint2)
Rotates the given point by 180 degrees counter clock-wise.
- Rotate240(GridPoint2)
Rotates the given point by 240 degrees counter clock-wise.
- Rotate300(GridPoint2)
Rotates the given point by 300 degrees counter clock-wise.
- Rotate60(GridPoint2)
Rotates the given point by 60 degrees counter clock-wise.
- RoundToGridPoint(Vector2)
Rounds a vector to the closest grid point if the points represent a hex grid.
- StarNorm(GridPoint2)
Returns the star norm of the point.
- StarNorm(Vector2)
Returns the star norm of the point.
- UpTriPseudoNorm(GridPoint2)
Returns the up-triangle pseudonorm of the given point.
- UpTriPseudoNorm(Vector2)
Returns the up-triangle pseudonorm of the given point.