Docs Navigation (Core Strategies)›

01. Mesh Triangulation Strategies

How SimplexViz constructs toothed 60-degree equilateral triangle lattices, selects orientation and parity, and pins fixed grids.

  • Core Strategies
  • 3 min read
  • Updated 2026-11-15

Key Takeaways

  • Every triangle in SimplexViz is a true 60-degree equilateral simplex (height h = s * sqrt(3) / 2), ensuring isotropic barycentric distances.
  • createAdaptiveHexMeshStrategy chooses horizontal vs. vertical orientation and row parity automatically from viewport aspect ratio.
  • createFixedLatticeMeshStrategy locks an exact (cols × rows) vertex count K across resizes.

Stage 1 (SimplexMeshStrategy) establishes the planar 2-complex of vertices, edges, and equilateral triangles before any items or clusters are placed. Because every face is an exact 60° equilateral triangle, barycentric weights (w_A, w_B, w_C) translate linearly into Euclidean proximity without aspect-ratio distortion.

Adaptive Hex Lattice

Maximizes 60° side length s inside viewport (W × H)

s = optimal pxV0V1V2V3V4V5V6V7

Fixed Grid Lattice

Pins exact vertex count K = cols × rows across resizes

0,00,10,21,01,11,22,02,1
Left: Adaptive Hex Mesh evaluates horizontal and vertical orientations plus staggered row parity (wideFirst) to maximize equilateral edge length s inside (W × H). Right: Fixed Lattice Mesh pins exact (row, col) grid topology.

Strategy Decision Matrix

Geometric Mechanics of the Adaptive Hex Lattice

Given viewport dimensions (W, H) and MeshOptions (innerPadding, minSideLength, maxSideLength, maxClusters), buildSimplexMesh:

  1. Computes the target cluster budget K ∈ [3, maxClusters] (maxClusters = 14 by default) from corpus richness or explicit clusterCount, and resolves an adaptive outer margin (32 px on compact mobile screens up to 48 px on desktop) when innerPadding is omitted.
  2. Enumerates candidate staggered hexagonal grids (rows, cols, orientation, wideFirst) where alternating rows offset by s / 2 along the primary axis and step by h = s · √3 / 2 along the perpendicular axis.
  3. Scores viable candidates (s ≥ minSideLength, 130 px by default) by viewport area efficiency, aspect-ratio alignment (automatically rotating into landscape on wide monitors and portrait on mobile screens), and cluster richness, applying maxSideLength purely as an optional upper cap when specified.

Explicit Triangle Side Length Override

Both built-in mesh strategies honor sideLength when you want deterministic world-space spacing regardless of monitor size:

import {
  createAdaptiveHexMeshStrategy,
  createFixedLatticeMeshStrategy,
} from '@simplex-viz/core';

// Adaptive topology with exact 210 px equilateral edges:
const adaptive = createAdaptiveHexMeshStrategy({
  innerPadding: 48,
  sideLength: 210,
  maxClusters: 10,
});

// Fixed 4×3 lattice (K = 12 vertices) with 195 px edges:
const fixed = createFixedLatticeMeshStrategy({
  cols: 4,
  rows: 3,
  orientation: 'horizontal',
  wideFirst: true,
  sideLength: 195,
});