new HexGrid( [options])
Hexagonal grids
Parameters:
| Name | Type | Argument | Description | ||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
options |
Object |
<optional> |
Properties
|
Extends
- ol.Object
Members
-
layout
-
Grid layout
Methods
-
coord2hex(coord)
-
Convert coord to hex
Parameters:
Name Type Description coordol.Coordinate Returns:
- Type
- ol.hex
-
cube2hex(c)
-
Convert cube to axial coords
Parameters:
Name Type Description col.Coordinate cube coordinate
Returns:
axial coordinate
- Type
- ol.Coordinate
-
cube2offset(c)
-
Convert offset to cube coords
Parameters:
Name Type Description col.Coordinate cube coordinate
Returns:
offset coordinate
- Type
- ol.Coordinate
-
cube_distance(a, a)
-
Calculate distance between to hexagon (number of cube)
Parameters:
Name Type Description aol.Coordinate first cube coord
aol.Coordinate second cube coord
Returns:
distance
- Type
- number
-
cube_line(a, b)
-
Calculate line between to hexagon
Parameters:
Name Type Description aol.Coordinate first cube coord
bol.Coordinate second cube coord
Returns:
array of cube coordinates
- Type
- Array.<ol.Coordinate>
-
cube_neighbors(c, direction)
-
Get the neighbors for an hexagon
Parameters:
Name Type Description col.Coordinate cube coord
directionnumber Returns:
neighbor || array of neighbors
- Type
- ol.Coordinate | Array.<ol.Coordinate>
-
cube_round(h)
-
Round cube coords
Parameters:
Name Type Description hol.Coordinate cube coordinate
Returns:
rounded cube coordinate
- Type
- ol.Coordinate
-
getHexagon(hex)
-
Get hexagon coordinates at hex
Parameters:
Name Type Description hexol.Coordinate Returns:
- Type
- Arrary.<ol.Coordinate>
-
getHexagonAtCoord(coord)
-
Get hexagon coordinates at a coordinate
Parameters:
Name Type Description coordol.Coordinate Returns:
- Type
- Arrary.<ol.Coordinate>
-
getLayout()
-
Get layout
Returns:
layout name
- Type
- HexagonLayout
-
getOrigin()
-
Get hexagon origin
Returns:
coord origin
- Type
- ol.Coordinate
-
getSize()
-
Get hexagon size
Returns:
hexagon size
- Type
- number
-
hex2coord(hex)
-
Convert hex to coord
Parameters:
Name Type Description hexol.hex Returns:
- Type
- ol.Coordinate
-
hex2cube(h)
-
Convert axial to cube coords
Parameters:
Name Type Description hol.Coordinate axial coordinate
Returns:
cube coordinate
- Type
- ol.Coordinate
-
hex2offset(h)
-
Convert offset to axial coords
Parameters:
Name Type Description hol.Coordinate axial coordinate
Returns:
offset coordinate
- Type
- ol.Coordinate
-
hex_corner()
-
Get hexagon corners
-
hex_neighbors(h, direction)
-
Get the neighbors for an hexagon
Parameters:
Name Type Description hol.Coordinate axial coord
directionnumber Returns:
neighbor || array of neighbors
- Type
- ol.Coordinate | Array.<ol.Coordinate>
-
hex_round(h)
-
Round axial coords
Parameters:
Name Type Description hol.Coordinate axial coordinate
Returns:
rounded axial coordinate
- Type
- ol.Coordinate
-
offset2cube(o)
-
Convert cube to offset coords
Parameters:
Name Type Description ool.Coordinate offset coordinate
Returns:
cube coordinate
- Type
- ol.Coordinate
-
offset2hex(o)
-
Convert axial to offset coords
Parameters:
Name Type Description ool.Coordinate offset coordinate
Returns:
axial coordinate
- Type
- ol.Coordinate
-
setLayout(layout)
-
Set layout
Parameters:
Name Type Description layoutHexagonLayout | undefined name, default pointy
-
setOrigin(coord)
-
Set hexagon origin
Parameters:
Name Type Description coordol.Coordinate origin
-
setSize(hexagon)
-
Set hexagon size
Parameters:
Name Type Description hexagonnumber size