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)
Fixed Grid Lattice
Pins exact vertex count K = cols × rows across resizes
Strategy Decision Matrix
createAdaptiveHexMeshStrategy(defaults?)
Re-evaluates orientation (horizontal vs. vertical) and wideFirst staggered parity on viewport resize to maximize equilateral side length s and area efficiency.
Open strategy reference →
createFixedLatticeMeshStrategy({ cols, rows, ... })
Scales equilateral side length s uniformly to fit (W, H) (unless sideLength is pinned) while keeping vertex grid topology strictly invariant.
Open strategy reference →
Geometric Mechanics of the Adaptive Hex Lattice
Given viewport dimensions (W, H) and MeshOptions (innerPadding, minSideLength, maxSideLength, maxClusters), buildSimplexMesh:
- Computes the target cluster budget
K ∈ [3, maxClusters](maxClusters = 14by default) from corpus richness or explicitclusterCount, and resolves an adaptive outer margin (32 pxon compact mobile screens up to48 pxon desktop) wheninnerPaddingis omitted. - Enumerates candidate staggered hexagonal grids
(rows, cols, orientation, wideFirst)where alternating rows offset bys / 2along the primary axis and step byh = s · √3 / 2along the perpendicular axis. - Scores viable candidates (
s ≥ minSideLength,130 pxby default) by viewport area efficiency, aspect-ratio alignment (automatically rotating into landscape on wide monitors and portrait on mobile screens), and cluster richness, applyingmaxSideLengthpurely 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,
});