Home
API: forms

Function: radiate()

lifecycle-kit

lifecycle-kit


lifecycle-kit / forms / radiate

Function: radiate()

radiate(unit, params): Path

Defined in: forms/rules/radiate.ts:56

Place count copies of a unit appendage radially around a centre.

The generalisation of pair from two sides to N: a starfish's arms, a sea anemone's tentacle ring, and — the consumer that actually needed this — a jellyfish's tentacles, which bioluminescent-sea draws with an ad hoc xRatio sweep under the name tentacleCount. spreadTurns covers both: 1.0 for the anemone's full ring, less than 1.0 for tentacles that trail from the underside of a bell rather than surrounding it.

The unit is authored pointing along +x from the centre; each copy is rotated to its position on the ring and translated out to center. Copies are count evenly spaced slots covering spreadTurns, always dividing by count and never by count - 1.

An earlier version divided by count - 1 below a full turn, so the last copy landed exactly at the far end of the spread, and switched to dividing by count at spreadTurns = 1 so a ring's first and last copy did not coincide. That is a genuine cliff at spreadTurns = 1 — sweeping through it jumps the last copy's angle discontinuously — and the continuity assay in radiate.test.ts exists precisely to catch this class of bug. One formula for every spread is what removes it: a partial arc's last copy sits one slot short of the spread's far edge rather than exactly on it, which is a real behaviour change from the inclusive-endpoint version, not a simplification of the same one.

Parameters

unit

Path

params

RadiateParams

Returns

Path