|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Six-neighbour hex pattern in axial coordinates over a 2D lattice. More...
#include <tpl_ca_neighborhood.H>
Public Types | |
| using | coord_type = Coord_Vec< 2 > |
| Coordinate type accepted by for_each_offset. | |
Static Public Member Functions | |
| static constexpr std::size_t | radius () noexcept |
| Return the radius of the neighborhood (always 1). | |
| static constexpr std::size_t | size () noexcept |
| Return the number of neighbours (always 6). | |
| template<typename F > | |
| static constexpr void | for_each_offset (const Coord_Vec< 2 > ¢er, F &&f) |
| Apply a functor to each of the six hex offsets. | |
Static Public Attributes | |
| static constexpr std::size_t | rank_v = 2 |
| Lattice dimension. | |
| static constexpr std::size_t | radius_v = 1 |
| Chebyshev radius (always 1 for hex grids). | |
| static constexpr std::size_t | size_v = 6 |
| Number of neighbours (always 6). | |
| static constexpr std::array< Offset_Vec< 2 >, 6 > | offsets = {{{1, 0}, {-1, 0}, {0, 1}, {0, -1}, {1, -1}, {-1, 1}}} |
| The six axial-coordinate offsets of the hex neighborhood. | |
Six-neighbour hex pattern in axial coordinates over a 2D lattice.
Axial coordinates encode a hexagonal grid using two integer axes (q, r). Each cell has six neighbours at offsets:
(+1, 0), (-1, 0), (0, +1), (0, -1), (+1, -1), (-1, +1)
The lattice itself is a regular 2D Lattice<Storage, Boundary>; hexagonal interpretation is purely a function of which offsets the rule consumes.
Definition at line 357 of file tpl_ca_neighborhood.H.
Coordinate type accepted by for_each_offset.
Definition at line 367 of file tpl_ca_neighborhood.H.
|
inlinestaticconstexpr |
Apply a functor to each of the six hex offsets.
| F | functor type. |
| [in] | center | the coordinate of the center cell (unused). |
| [in] | f | functor to apply to each Offset_Vec<2>. |
Definition at line 395 of file tpl_ca_neighborhood.H.
References Aleph::blossom_maximum_cardinality_matching(), and offsets.
Return the radius of the neighborhood (always 1).
1. Definition at line 376 of file tpl_ca_neighborhood.H.
Return the number of neighbours (always 6).
6. Definition at line 384 of file tpl_ca_neighborhood.H.
|
staticconstexpr |
The six axial-coordinate offsets of the hex neighborhood.
Definition at line 370 of file tpl_ca_neighborhood.H.
Referenced by for_each_offset(), and TEST().
|
staticconstexpr |
Chebyshev radius (always 1 for hex grids).
Definition at line 363 of file tpl_ca_neighborhood.H.
|
staticconstexpr |
Lattice dimension.
Definition at line 361 of file tpl_ca_neighborhood.H.
|
staticconstexpr |
Number of neighbours (always 6).
Definition at line 365 of file tpl_ca_neighborhood.H.