|
Aleph-w 3.0
A C++ Library for Data Structures and Algorithms
|
Hexagonal lattice with axial / offset / cube coordinate conversions and a TikZ-compatible pixel mapping. More...
#include <array>#include <cmath>#include <cstddef>#include <ostream>#include <sstream>#include <string>#include <ah-errors.H>#include <ca-traits.H>#include <tpl_ca_concepts.H>#include <tpl_ca_lattice.H>Go to the source code of this file.
Classes | |
| struct | Aleph::CA::Hex_Axial |
Axial integer coordinates (q, r) of a hex cell. More... | |
| struct | Aleph::CA::Hex_Offset |
Offset coordinates (col, row) for visualisation. More... | |
| struct | Aleph::CA::Hex_Cube |
Cube coordinates (x, y, z) with the constraint x+y+z = 0. More... | |
| class | Aleph::CA::Hex_Lattice< Storage, Boundary > |
| Hexagonal lattice with axial accessors over a 2D storage. More... | |
Namespaces | |
| namespace | Aleph |
| Main namespace for Aleph-w library functions. | |
| namespace | Aleph::CA |
Hexagonal lattice with axial / offset / cube coordinate conversions and a TikZ-compatible pixel mapping.
Hexagonal CAs are conventionally described in axial coordinates (q, r): two integer axes selected so that neighbour offsets are symmetric (six unit steps, including two diagonals). Storing the cells as a regular 2D row-major buffer indexed by (r, q) matches the rectangular bounding parallelogram of the hex grid; visualizers switch to offset coordinates (col, row) (even-r or odd-r) where alternate rows are shifted by half a hex.
This header does three things:
Hex_Axial, Hex_Offset, Hex_Cube value types and free functions to convert between them. All conversions are lossless and round-trip exactly for valid inputs.Hex_Lattice<Storage, Boundary>, a thin subclass of Lattice<Storage, Boundary> that adds axial/offset accessors and a hexagonal pixel mapping. The 2D rank is preserved, so the same Synchronous_Engine / Parallel_Synchronous_Engine and the existing Hex_Neighborhood (six axial offsets) work unchanged.render_hex_lattice_tikz to dump a frame as a TikZ picture for inclusion in reports / papers.Storage convention: coord c = {r, q}. Axis 0 stores r (axial row), axis 1 stores q (axial column). This matches the standard CA convention where axis 0 is the slowest-varying axis, and keeps the data layout cache-friendly for row-by-row iteration.
Definition in file tpl_ca_hex_lattice.H.