Reference · Build a mesh and a drawing
Builttype
A rocket built from a description: the fit report, its parts, and the ways to ask for its size, where each part stands, its lit engines, a .glb file and a drawing.
Import it
import type { Built } from "@johnmorrisdotca/uchusen-rockets/build";
Definition
interface Built {
report: FitReport;
parts: readonly BuiltPart[];
beside: readonly BuiltPart[];
names: readonly string[];
shows: readonly string[];
boundsOf(show?: string, lit?: boolean): Bounds;
placesOf(show?: string): {
slot: string;
at: Vec3;
shown: boolean;
}[];
flamesOf(show?: string): LitBell[];
glb(): Glb;
svg(options?: SvgOptions): string;
}
Members
| Name | Type | Description |
|---|---|---|
report | FitReport | |
parts | readonly BuiltPart[] | |
beside | readonly BuiltPart[] | The parts of the rocket standing beside it, when it was built |
names | readonly string[] | The words that name each craft in a picture of several, in the order they stand from the left: the rocket first, then each beside it. Empty unless it was built to name them. |
shows | readonly string[] | What can be shown: together, apart and each part. |
boundsOf | (show?: string, lit?: boolean): Bounds | The bounds of a choice of what to show, in metres, and with |
placesOf | (show?: string): { slot: string; at: Vec3; shown: boolean; }[] | Where each part stands for a choice of what to show. |
flamesOf | (show?: string): LitBell[] | The engines alight at full thrust for a choice of what to show: those the drawing has, of the parts whose engines a source tells of. |
glb | (): Glb | The .glb file's bytes: every part stacked, each its own node to move. |
svg | (options?: SvgOptions): string | The drawing, in a look, from an angle. |
Examples
import { build, type Built } from "@johnmorrisdotca/uchusen-rockets/build";
const rocket: Built = build({ rocket: "starship", variant: "v3" });
console.log(rocket.shows.join(", "));
console.log(rocket.boundsOf("together").max);together, apart, booster, ship
[ 9.149999999999999, 124.4, 9.149999999999999 ]What it prints (run when this page was built)