Six times sixty equals three hundred and sixty: not a human choice, a geometric inevitability.
A TypeScript library implementing the navigational lattice β the geometric framework where bisection and trisection of 360Β° interlace to create a coordinate system rooted in ancient sexagesimal mathematics. The Sumerians chose 60 because it's the smallest number divisible by 1, 2, 3, 4, 5, 6, 10, 12, 15, 20, and 30. Base-60 is the natural radix for geometry.
Repo: SuperInstance/base60-lattice
The lattice was built for space. LatticeStamp gives it a second hand for
time: a timestamp becomes a lattice coordinate, and "the room at this
hour, last week" becomes a real query. The civil clock is already sexagesimal β
24 hours Γ 60 minutes Γ 60 seconds is the Sumerians' base-60 still ticking.
flowchart LR
ts["timestamp<br/>(epoch ms)"] --> fromDate["fromDate(ts)"]
fromDate --> fields["hour60 Β· day60 Β· phase Β· season<br/>(lattice fields)"]
fields --> bucket["bucketKey(ts, granularity)<br/>hΒ·pΒ·dΒ·wΒ·s keys"]
fields --> vec["stampToVector(ts)<br/>[hour60/60, day60/60, phase/6, season/4]"]
bucket --> gate["latticeMatch(a, b, g)"]
vec --> time["JEPA-RAG time dimension<br/>(ride beside readings + space)"]
gate --> query["query_time(window) + lattice hour gate<br/>β the room at this hour, last week"]
| granularity | bucket | "the same β¦" |
|---|---|---|
hour |
h${clockHour} |
the same clock hour β "the same hour yesterday" |
phase |
p${phase} |
the same phase of the night (6 Γ 60Β° = 360Β°) |
day |
d${dayOfYear} |
the same day of the year |
weekday |
w${weekday} |
the same weekday (the weekly rhythm) |
season |
s${season} |
the same season |
Read the full writeup in docs/lattice-time.md.
Bisection (dyadic): 360 β 180 β 90 β 45 β 22.5 β 11.25 β ...
Trisection (triadic): 360 β 120 β 40 β 13.33 β 4.44 β ...
Where they nearly coincide β INTERLACE POINTS (harmonic consonances)
The Pythagorean triple (3, 4, 5) is the fundamental lattice walking primitive:
- 3 steps East β 4 steps North β 5 steps diagonal (return)
- Perimeter: 12 units Β· Area: 6 square units Β· Diagonal: arctan(4/3) β 53.13Β°
- Compose walks at different orientations to traverse the entire lattice
Six equilateral triangles meet at each vertex (6 Γ 60Β° = 360Β°). The hexagonal tiling is the unique regular tiling that preserves the trisection structure. Each hexagon decomposes into 6 equilateral triangles whose centroids form a smaller hexagon β a self-similar fractal structure.
| Module | File | What It Does |
|---|---|---|
| Lattice | src/lattice.ts |
Generates lattice nodes from interlaced bisection/trisection trees |
| Compass | src/compass.ts |
360Β° compass rose with sextant naming, SVG rendering, base-60 bearings |
| Walk | src/walk.ts |
3-4-5 triangle walks, Pythagorean triples, hexagonal paths, spirals |
| Lattice Stamp | src/latticeStamp.ts |
fromDate, bucketKey, stampToVector, latticeMatch, timeWindowQuery β time as a lattice coordinate for the JEPA-RAG |
npm install base60-latticeimport { generateLattice, walk345, HexGrid, compassSVG } from 'base60-lattice';
// Generate lattice nodes
const nodes = generateLattice(6, 6);
console.log(`${nodes.length} lattice nodes`);
// Walk a 3-4-5 triangle
const walk = walk345();
console.log(`Closed: ${walk.closed}, Area: ${walk.enclosedArea}`);
// Generate hexagonal patch
const grid = new HexGrid(1);
const patch = grid.generatePatch(3);
// Render compass rose
const svg = compassSVG(200);generateLattice(bisectDepth, trisectDepth)β all lattice nodesbisectionChain(depth)/trisectionChain(depth)β individual chainsfindInterlacePoints(bisectDepth, trisectDepth)β harmonic interlacestoBase60(degrees)β convert to sexagesimal
generateCompassRose(includeDegrees?)β all markscompassSVG(radius?)β render as SVGbearingLabel(degrees)β human-readable bearing
walk345(scale?)β the primitive walkwalkPythagorean(a, b)β any Pythagorean triplewalkHexagon(sideLength)β hexagonal pathwalkSpiral(turns)β square spirallatticePath(from, to)β Manhattan path
HexGridclass β axial coordinatesgeneratePatch(radius)/neighbors(q, r)/distance(q1, r1, q2, r2)
fromDate(ts)β stamp a timestamp:{ hour60, day60, phase, season, bucket }bucketKey(ts, granularity)β lattice-aligned key (hour/phase/day/weekday/season)stampToVector(ts)β[hour60/60, day60/60, phase/6, season/4], the RAG's time dimensionlatticeMatch(a, b, granularity)β same-lattice-bucket gatetimeWindowQuery(stamps, from, to)β the hard time filter, sortedtoEpochMs/isLeapYear/dayOfYear/seasonForMonth/phaseForMinutesβ pure helpers
Base-60 Lattice is the geometric foundation for the fleet's math cluster:
- β murmur β permutation tensors that navigate this lattice
- β fleet-jepa-midi β 12-pulse jazz built on lattice intervals
- β platonic-randomness β Catan 2d6 distributions on lattice topology
- β slackwater-lattice β Python port for game agent spatial reasoning
- β slackwater-tempo β musical time as lattice walking
- β voxel-logic β voxel engine built on hex/lattice primitives
The lattice is also the spatial math behind:
- β mud-engine β world topology and room adjacency
- β spatial-registry β 4 worlds, 33 rooms placed on lattice coordinates
- β terrain β MUD-to-visual bridge using lattice hexagons
- β elephant β JEPA-RAG with readings, time, and space stamps as first-class citizens; the lattice's time dimension (
LatticeStamp) is the RAG's time grammar
npm testEight test suites, 466 tests total β all passing.
| Suite | File | Tests | Focus |
|---|---|---|---|
| Core | tests/lattice.test.ts |
28 | Mathematical invariants β bisection/trisection chains, interlace detection, compass generation, walk closure, hex grid topology |
| Edge Cases | tests/edge-cases.test.ts |
48 | Boundary conditions, weird inputs, property-based invariants |
| NaN Safety | tests/nan-safety.test.ts |
88 | NaN firewall for every public function |
| Lattice Deep | tests/lattice-deep.test.ts |
44 | toBase60 conversions, exported constants, unit circle invariants |
| Compass | tests/compass.test.ts |
56 | Mark hierarchy, type promotion, SVG structure, bearing labels |
| Walk | tests/walk.test.ts |
73 | All walk primitives, Pythagorean triples, NaN safety |
| Hex Grid | tests/hex-grid.test.ts |
82 | Coordinate precision, neighbors, distances, patches, SVG |
| Lattice Stamp | tests/lattice-stamp.test.ts |
47 | Time as a lattice coordinate β fields, buckets, vector normalization, granularity gates, NaN firewall |
examples/navigation-demo.tsβ Plot a course using lattice walking primitivesexamples/walk-demo.tsβ All walking primitives: 3-4-5, Pythagorean, hexagon, spiralexamples/hex-grid-demo.tsβ Hex grid operations: patches, neighbors, distancesexamples/compass-demo.tsβ Compass rose generation and bearing labelsdemo/index.htmlβ Interactive visual demo with canvas rendering
This library lives in the fleet's math cluster alongside research on cultural mathematics and music-and-math in AI-Writings. The lattice connects ancient navigation (Sumerian, Babylonian) to modern computational geometry β the same math that makes hex grids work in games, that makes music theory consonant, and that makes GPS coordinates land on integer values.
MIT Β© SuperInstance
