Reference · Build a mesh and a drawing
drawnPiecesfunction
What a drawing draws of a part: in a stack, what nests inside the part below is out of sight.
Import it
import { drawnPieces } from "@johnmorrisdotca/uchusen-rockets/build";
Definition
function drawnPieces(part: { record: PartRecord; pieces: readonly Piece[]; }, together: boolean): readonly Piece[]
Parameters
| Name | Type | Description |
|---|---|---|
part | { record: PartRecord; pieces: readonly Piece[]; } | A built part: its record and its pieces. |
together | boolean | True when the part stands in a stack, false when it is shown alone. |
Returns
readonly Piece[]
The pieces to draw. In a stack, what nests inside the part below is left out.
Examples
import { build, drawnPieces } from "@johnmorrisdotca/uchusen-rockets/build";
const [first] = build({ rocket: "falcon-9", variant: "block-5" }).parts;
if (first) console.log(drawnPieces(first, true).length, drawnPieces(first, false).length);131 131What it prints (run when this page was built)