Docs Navigation (Core Strategies)›

04. Composable Collision Layout (Seeder × Relaxer × ScaleController)

How SimplexViz guarantees 0.0 px overlap across arbitrary convex shapes and JSX cards by composing Seeders, Position Relaxers, and Scale Controllers.

  • Core Strategies
  • 5 min read
  • Updated 2026-11-19

Key Takeaways

  • Every built-in layout strategy strictly enforces two hard invariants: covering-triangle containment and 0.0 px convex SAT overlap.
  • Layout pipelines decompose orthogonally into LayoutSeeder × PositionRelaxer × ScaleController.
  • Collision-Driven Local Scaling keeps sparse neighborhoods at full 1.0x size and shrinks only locally colliding pockets.

Stage 4 (SimplexLayoutStrategy) transforms abstract barycentric weights into exact 2D world coordinates (x, y) and per-node scale factors (clusterScale, itemScales) for arbitrary ConvexGeometry hulls (circles, regular polygons, star hulls, or measured React/SVG bounding boxes).

Uniform PBD

Global scale α = 0.50 everywhere preserves exact size ratios

α = 0.50α = 0.50 (uniform)

Collision-Local Pocket

Only colliding pockets shrink; sparse triangles stay at 1.00x

α = 0.50 (drillable)α = 1.00 (leaf)

Density-Adaptive

Smooth radial crowd kernel R transitions core → fringe size

Smooth R = 76 px size gradient
Same skewed mesh distribution evaluated under all three scaling modes: Uniform PBD shrinks every node globally to α = 0.50 to keep size ratios exact; Collision-Local Pocket shrinks only overlapping pockets while keeping sparse triangles at 1.00x leaf scale; Density-Adaptive computes a smooth radial gradient over crowdRadiusPx.

Built-In Layout Strategies

Orthogonal Building Blocks (createComposedLayoutStrategy)

Instead of monolithic layout algorithms, SimplexViz factors layout solving into three composable interfaces:

1. LayoutSeeder (Initial Placement)

  • createPhyllotaxisSeeder() — Places co-located items on a golden-angle Vogel spiral (θ_n = n · 137.508°) around their barycentric target.
  • createMeshInwardFanSeeder() — Fans vertex-anchored items smoothly toward incident mesh sectors to maximize initial clearance before relaxation.
  • withWarmStartSeeder(seeder) — Reuses settled coordinates from the previous frame for existing item IDs so live mutations settle with minimal visual displacement.

2. PositionRelaxer (Iterative PBD + SAT/MTV Separation)

  • createBarycentricPbdRelaxer() — Couples a gentle spring toward each item’s exact barycentric target with Separating Axis Theorem (SAT) Minimum Translation Vector (MTV) impulses accelerated by UniformSpatialHashGrid.
  • createSpaceFillingPbdRelaxer() — Adds short-range electrostatic-style dispersion inside covering triangles so nodes utilize open triangle interiors evenly.

3. ScaleController (Adaptive Node Sizing)

  • createUniformScaleController() — Binary-searches a single global α ∈ [minContentScale, 1]; ideal when node radius encodes a quantitative metric (e.g. citations or duration) whose global ratio must stay exact.
  • createCollisionLocalScaleController() — Starts every item at 1.0x and iteratively multiplies only actively colliding pairs by shrinkFactor (0.85 default, bounded by minLocalScale). Pairs naturally with hierarchical 1:4 drill-down!
  • createDensityPriorScaleController() — Runs a 1.0x space-filling dispersion pass first, evaluates smooth radial crowd density within crowdRadiusPx (76 px) on the dispersed positions, and resolves any residual collisions locally with halo blending.
  • createFixedScaleController({ scale: 1.0 }) — Locks node scale at a constant factor without auto-shrinking.

Preset & Custom Composition Example

import {
  createComposedLayoutStrategy,
  createMeshInwardFanSeeder,
  createSpaceFillingPbdRelaxer,
  createCollisionLocalScaleController,
} from '@simplex-viz/core';

const customLayout = createComposedLayoutStrategy({
  seeder: createMeshInwardFanSeeder(),
  relaxer: createSpaceFillingPbdRelaxer({
    springFactor: 0.7,
    dispersionGapPx: 18,
  }),
  scaleController: createCollisionLocalScaleController({
    minLocalScale: 0.32,
    shrinkFactor: 0.85,
  }),
  warmStart: true,
});

Chronological Layout Stability (createFinalSeededLayoutStrategy)

Just as createFinalSeededClusteringStrategy pins cluster vertices across chronological timeline frames (0 → N), createFinalSeededLayoutStrategy wraps any Stage 4 layout strategy to solve canonical full-corpus (x, y) coordinates once (when canonicalSeedItems are provided) and reuse them path-independently across subsets:

import {
  createFinalSeededLayoutStrategy,
  createCollisionDrivenLayoutStrategy,
} from '@simplex-viz/core';

const chronologicalLayout = createFinalSeededLayoutStrategy(
  createCollisionDrivenLayoutStrategy(),
  {
    scaleMode: 'adaptive',        // 'pinned' | 'adaptive'
    unseenItemPolicy: 'fallback', // 'fallback' | 'reseed'
  },
);
  • scaleMode: 'pinned' (Default): Freezes both the canonical (x, y) positions and the final full-corpus item scales. Earlier items never slide, shrink, or jump as later items enter—making frame N strictly identical whether reached by stepping forward, scrubbing backward, or jumping directly to the end.
  • scaleMode: 'adaptive': Keeps every item anchored at its exact canonical (x, y) position, while expanding sparse early-frame items symmetrically up to 1.0x via exact SAT convex clearance checks (0.0 px overlap guaranteed) so early frames stay readable without sacrificing spatial landmarks.
  • unseenItemPolicy: Controls what happens if a live mutation introduces an item ID absent from the canonical seed ('fallback' delegates to the wrapped base strategy for that frame; 'reseed' updates the canonical seed automatically).
  • One-line Timeline Integration: In @simplex-viz/svg and @simplex-viz/react, setting timeline={{ ..., autoFinalSeedLayout: 'adaptive' }} (or 'pinned') automatically wraps your active layoutStrategy and feeds the full timeline corpus via canonicalSeedItems.