Skip to main content

Function: randomSpringPositions()

randomSpringPositions(vertices, scale, center, random): Map<VertexId, SpringPoint>

Defined in: src/mobjects/graph/layoutAlgorithms.ts:137

Create the initial spring positions for the vertices.

Each vertex gets a position inside a box of side scale * 2 around center. Pass a deterministic random function (0..1) for a repeatable layout.

Parameters​

vertices​

VertexId[]

scale​

number

center​

Vector3Tuple

random​

() => number

Returns​

Map<VertexId, SpringPoint>