Skip to content

@graphty/layout / index / seedPositions

Function: seedPositions() ​

seedPositions(s, positions, seed, dim, scale, center, range): void

Defined in: simulation/seed.ts:93

Seeds the unseeded rows of the owner's stride-3 SCENE array in index order (spec 9.3 seedPositions, 7.14 pos, 7.19 topology change): a row is unseeded when any of its dim components is not finite; every such component draws one LCG value; when NO row is fully finite the draw is uniform in [-1, 1) layout units per axis (range: "fa2"; "fr" is [0, 1)), otherwise uniform inside the [min, max] box of the finite components per axis, converted to layout units (an axis with no finite value falls back to the range box); the value is written as v * scale + center[axis], which for scale 1 / center 0 is bit-identical to the port's u * 2 - 1 (resp. u); in 2D the third component of a seeded row is written as center[2]. An axis whose finite box has zero width (one finite row, or every finite row sharing that coordinate) is padded to the range box's width centered on it, so the drawn rows never all land on one point or one line. Finite components are never changed and a fully finite row is never touched. No random number is drawn when nothing needs seeding. PLAN DECISION 12 (P3-T1): the box is taken over every finite COMPONENT (the port's rule), not over the fully finite ROWS only; the two differ only when a partially finite row's finite axis lies outside the fully finite rows' box (pinned by webgpu-graph-algorithms/test/layouts/seed.test.ts). PLAN DECISION 13: a 2D row whose x and y are finite is seeded whatever its z holds.

Parameters ​

s ​

GraphSnapshot

the snapshot (nodeCount rows)

positions ​

F32 | F64

the owner's stride-3 scene-unit array, length 3 * nodeCount, modified in place; an F64 array keeps the drawn values in float64, as the legacy layouts did

seed ​

number | null

the LCG seed (0 / null = unseeded, the port's quirk)

dim ​

2 | 3

2 or 3

scale ​

number

the scene scale (> 0)

center ​

ArrayLike<number> | null

the scene center, or null for the origin

range ​

"fa2" | "fr"

"fa2" for [-1, 1), "fr" for [0, 1)

Returns ​

void