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
Collision-Local Pocket
Only colliding pockets shrink; sparse triangles stay at 1.00x
Density-Adaptive
Smooth radial crowd kernel R transitions core → fringe size
Built-In Layout Strategies
createPbdUniformLayoutStrategy()
Mesh-inward fan seeder + space-filling PBD dispersion + binary search for a single global scale factor α with 0.0 px convex SAT overlap.
Open strategy reference →
createCollisionDrivenLayoutStrategy()
Mesh-inward fan seeder + space-filling PBD + local collision shrinking so sparse triangles remain at full 1.0x leaf scale (ideal with 1:4 drill-down).
Open strategy reference →
createWarmStartPbdLayoutStrategy()
Reuses settled previous-frame world coordinates with space-filling PBD relaxation and uniform global scale ratios for minimal visual displacement.
Open strategy reference →
createLocalAdaptiveLayoutStrategy()
Spreads items across open covering triangles first, evaluates smooth neighborhood crowd density within radius R, and polishes locally without global shrink.
Open strategy reference →
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 byUniformSpatialHashGrid.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 at1.0xand iteratively multiplies only actively colliding pairs byshrinkFactor(0.85default, bounded byminLocalScale). Pairs naturally with hierarchical1:4drill-down!createDensityPriorScaleController()— Runs a1.0xspace-filling dispersion pass first, evaluates smooth radial crowd density withincrowdRadiusPx(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 frameNstrictly 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 to1.0xvia exact SAT convex clearance checks (0.0 pxoverlap 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/svgand@simplex-viz/react, settingtimeline={{ ..., autoFinalSeedLayout: 'adaptive' }}(or'pinned') automatically wraps your activelayoutStrategyand feeds the full timeline corpus viacanonicalSeedItems.