Reference · Rockets, variants, parts and the fit check
placesForfunction
Where each part stands: up the stack joint to joint, or spread apart on a diagonal of the ground, or one part alone.
Import it
import { placesFor } from "@johnmorrisdotca/uchusen-rockets";
Definition
function placesFor(parts: readonly { slot: string; part: PartRecord; }[], show: string, widthOf: WidthOf): Place[]
Parameters
| Name | Type | Description |
|---|---|---|
parts | readonly { slot: string; part: PartRecord; }[] | The parts with their slots, from the bottom. |
show | string | What to show. |
widthOf | WidthOf | The width of a part, for spacing when they are apart. |
Returns
Place[]
A place for each part.
Examples
import { build } from "@johnmorrisdotca/uchusen-rockets/build";
import { placesFor } from "@johnmorrisdotca/uchusen-rockets";
const rocket = build({ rocket: "falcon-9", variant: "block-5" });
const parts = rocket.parts.map((part) => ({ slot: part.slot, part: part.record }));
console.log(placesFor(parts, "apart", (part) => part.diameter / 2).map((place) => place.slot));[ 'first-stage', 'second-stage', 'fairing' ]What it prints (run when this page was built)