Home
API: forms

Function: branch()

lifecycle-kit

lifecycle-kit


lifecycle-kit / forms / branch

Function: branch()

branch(unit, params): Path

Defined in: forms/rules/branch.ts:48

Recursively place shrunk, rotated copies of a unit at its own tip.

repeat places identical copies along a line; branch places self-similarly SHRINKING copies along a tree, which is the shape a fern frond, a coral colony and an antler actually have. The recursion is the whole rule — a fern with more leaflets and a coral with more forks are the same call with a larger depth, never a separate fernForm.

The unit is authored pointing along +x with unit length; each generation attaches at attachAt fraction along the previous generation's (already shrunk) length, fans out by angle per split, and shrinks again by shrink. Recursion bottoms out at depth <= 0 rather than at a size threshold, so shrink staying exactly 1 (no shrink at all) still terminates — a correctness property a size-based cutoff would not have.

Parameters

unit

Path

params

BranchParams

Returns

Path