-
Notifications
You must be signed in to change notification settings - Fork 0
Hygrid
Note
Status: IMPLEMENTED Role: Spatial Substrate
Hygrid is HYWE's discrete spatial substrate: an integer hybrid orthogonal-hexagonal lattice used to represent, transform, and resolve spatial topology before any continuous geometric projection occurs.
It is not the primary research proposition of HYWE, but rather the essential foundation that makes deterministic spatial computation possible.
Standard coordinate systems force a choice:
- Square grids natively support orthogonal architectural massing but struggle with the topological flexibility required for organic spatial relationships.
- Regular hexagonal lattices natively support organic, 6-way topological flow but are computationally heavy and map poorly to orthogonal architectural boundaries.
The Hygrid resolves this by acting as a hybrid. It enforces six-way adjacency tables on an underlying Cartesian coordinate system. By sacrificing geometric isotropy for arithmetic determinism, it allows HYWE to seamlessly bridge abstract, organic topology and strict orthogonal massing.
From everything visible in its structure and implementation, the Hygrid is a mathematically original coordinate system. It is a purpose-designed integer hybrid orthogonal-hexagonal lattice whose primary engineering goal is bit-exact arithmetic and deterministic growth, rather than geometric purity.
It qualifies as a fundamentally new discrete geometry because:
- It is not cube, axial, offset, or doubled (the four standard hexagonal systems used in games and computer science).
- It is not a regular hexagonal lattice. The neighbour vectors and modular validation rules produce a sparse hybrid point set.
- It is not a simple square or rectangular grid, yet it retains explicit six-way adjacency tables.
The unique combination of tagged integer triples, orientation-dependent parity constraints (% 2 / % 4), and 24 hard-coded anisotropic neighbour tables (encoding orientation, rotation, and start direction simultaneously) does not match any widely documented discrete lattice used in computational geometry or architectural layout engines. It is a custom coordinate system invented specifically for HYWE's deterministic topology engine.
At the lowest level, spatial coordinates are represented by the Hxl (Hexel) type.
type Hxl =
| AV of x: int * y: int * z: int // Available
| RV of x: int * y: int * z: int // Reserved
| EX of x: int * y: int * z: int // Excluded-
x, y: Planar integer coordinates mapped to a sparse valid subset. -
z: Elevation/layer (also integer). - The three tags carry occupancy semantics used by the growth algorithms.
Because coordinates are pure integers, there is no floating-point math during the generation phase. This ensures perfect bit-exact reproducibility across devices and enables HYWE's dependency-free, kernel-free WebAssembly execution.
The lattice exists in two orientations, selected by the active sequence operator. Because it is a topological distortion mapped to an orthogonal grid, these steps are larger and anisotropic compared to the unit vectors of a regular hexagonal lattice.
| Family | Sequence prefix | Primary axis alignment | Typical neighbour steps |
|---|---|---|---|
| Vertical | VR... |
columns more orthogonal |
(±2,0), (±1,±2)
|
| Horizontal | HR... |
rows more orthogonal |
(0,±2), (±2,±1)
|
Every coordinate is forced onto the legal lattice by a pair of parity rules that depend on the active orientation. The validation function (hxlVld) is applied twice for safety, resulting in a sparse integer point set that seamlessly mixes orthogonal and hexagonal connectivity.
Vertical Rules:
| b % 4 = 0 → adjust x to even/odd consistency
| a % 2 = 0 → force y even
| otherwise → force y evenHorizontal Rules:
| a % 4 = 0 → adjust y
| b % 2 = 0 → force x even + nudge y
| otherwise → force x evenNeighbours are never computed dynamically from a universal formula. Instead, they are looked up from one of the 24 hard-coded sequence tables:
sequence : Sqn → (int * int)[] // self + 6 offsetsFor example, a Vertical, Clockwise sequence starting East (VRCWEE) yields:
VRCWEE → [| 0,0; 2,0; 1,-2; -1,-2; -2,0; -1,2; 1,2 |]These six offsets already incorporate both the hybrid anisotropic spacing and the chosen rotation/start direction. Adding them to a validated host coordinate yields the six mathematically adjacent cells (subject to Hxl occupancy checks).
By passing an architectural program through each of these 24 hard-coded operators, the engine comprehensively explores topological possibilities deterministically. The exact same integer state combined with the exact same sequence operator yields the identical set of physical cells.
Hexels do not exist in isolation. During generation, they cluster into Coxels (simultaneously evolving spatial containers). Because the Hygrid substrate provides 6-way adjacency without complex floating-point kernels, Coxels can organically grow, collide, and negotiate boundaries purely through fast integer offset lookups.
| Operation | How it is performed |
|---|---|
| Neighbour test | Integer offset lookup + occupancy set check. |
| Distance / range | Not a classic cube distance; derived purely from the growth process itself. |
| Line drawing | Custom integer stepping (hxlLin) that respects the specific orientation parity rules. |
| Boundary clipping | Integer point-in-polygon style tests performed directly on the validated lattice. |
| Area | A simple count of occupied integer cells (scaled later for display). |
To appreciate the Hygrid, it is useful to compare it against conventional approaches for mapping hexagons to computer memory:
| Classical system | Hygrid relationship |
|---|---|
| Cube / Axial Coordinates | Uses a different address space, different neighbour vectors, and drops the 3-axis |
| Offset (odd-r / even-q) | Shares the abstract idea of row parity, but Hygrid's actual spacing and modulo validation rules are unique. |
| Square grid | Orthogonal steps exist in the Hygrid, but six-way adjacency is formally retained. |
| Regular hexagonal tiling | Explicitly avoided. Because of the integer mapping, the cells are not regular hexagons. They are a topological distortion. |
The Hygrid operates purely in the realm of topology and integer state. It is only after the full spatial configuration (the Ensemble) is resolved on this discrete substrate that the system hands the data off to the geometry phase (Xyxel / Zaxel / Goxel).
At this final stage, the discrete topological units are projected into continuous space to generate the final SVG floor plans and WebGPU volumetric massing.