Skip to content

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

Β 

History

12 Commits

Folders and files

Repository files navigation

πŸ”’ Base-60 Navigational Lattice

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 celestial clockwork lattice β€” glowing rings marking hours and days over a quiet harbor, one ring lit (the moment being retrieved)


The Time Dimension β€” Lattice Stamps

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"]
Loading
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.


The Mathematics

Two Trees, One Lattice

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 3-4-5 Triangle Walk

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

Hexagonal Tiling

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.


Modules

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

Installation

npm install base60-lattice

Usage

import { 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);

API

Lattice

  • generateLattice(bisectDepth, trisectDepth) β€” all lattice nodes
  • bisectionChain(depth) / trisectionChain(depth) β€” individual chains
  • findInterlacePoints(bisectDepth, trisectDepth) β€” harmonic interlaces
  • toBase60(degrees) β€” convert to sexagesimal

Compass

  • generateCompassRose(includeDegrees?) β€” all marks
  • compassSVG(radius?) β€” render as SVG
  • bearingLabel(degrees) β€” human-readable bearing

Walking

  • walk345(scale?) β€” the primitive walk
  • walkPythagorean(a, b) β€” any Pythagorean triple
  • walkHexagon(sideLength) β€” hexagonal path
  • walkSpiral(turns) β€” square spiral
  • latticePath(from, to) β€” Manhattan path

Hexagonal Grid

  • HexGrid class β€” axial coordinates
  • generatePatch(radius) / neighbors(q, r) / distance(q1, r1, q2, r2)

Lattice Stamp

  • 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 dimension
  • latticeMatch(a, b, granularity) β€” same-lattice-bucket gate
  • timeWindowQuery(stamps, from, to) β€” the hard time filter, sorted
  • toEpochMs / isLeapYear / dayOfYear / seasonForMonth / phaseForMinutes β€” pure helpers

Navigator's Equation Connection

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

Tests

npm test

Eight 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


The Cultural Math Connection

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.


License

MIT Β© SuperInstance

About

No description, website, or topics provided.

Resources

Code of conduct

Contributing

Security policy

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages