Home
API: forms

Function: pair()

lifecycle-kit

lifecycle-kit


lifecycle-kit / forms / pair

Function: pair()

pair(unit, params): Path

Defined in: forms/rules/pair.ts:55

Emit a left/right mirrored pair of a unit appendage at an attachment point.

bioluminescent-sea independently arrived at this exact shape under a different name — a jellyfish's tentacleCount loop draws each tentacle at xRatio positions that are symmetric about the bell's centreline, which is pair generalised to more than two. This rule is the two-sided case because two-sidedness (bilateral symmetry) is the overwhelmingly common body plan; radiate is what generalises it to jellyfish tentacles or starfish arms.

The unit appendage is authored pointing away from the body along +y; pair translates it into place and reflects the second copy across the body's long axis, so a leg drawn once becomes bilaterally symmetric for free rather than needing to be authored twice.

Which axis

path.ts fixes the convention that a body's long axis runs along +x, and repeat callers lay bodies out that way. The plane of bilateral symmetry therefore CONTAINS the x axis, so mirroring to the other side negates y and leaves x alone. Both members keep their station along the body: a foreleg mirrors to the opposite foreleg, not to a hindleg.

This rule originally mirrored across x instead, which negates the along-body coordinate. Both members came out sharing a y and straddling the origin in x — one at the head end, one at the tail end, both on the same side of the animal. Every existing test still passed, because none of them asserted which axis separated the two members; it took drawing a creature to see it.

Parameters

unit

Path

params

PairParams

Returns

Path