Skip to main content
100%

Gist 1825fd83399f5e4df6f8b0d10399f465

✓ Published0🌍 Public
MMAKIO135
Last edited Apr 11, 2019
Created on Apr 11, 2019

This example displays a hexagon grid built from scratch, with two layout modes: flat-topped and pointy-topped hexagons. The visualization shows how hexagonal tiling can be generated programmatically, calculating exact vertex positions and cell centers based on geometric constants. The HexGrid class handles both orientations, spacing cells in a brick-like pattern that accounts for row offsets. Using custom math rather than a charting library, the grid’s points are derived from basic trigonometry and coordinate arithmetic. The code logs grid dimensions and counts to the console, revealing the underlying structure of the hexagonal lattice.

AI-generated description

Similar vizzes