All problems

Inlay motifs are misplaced when their wooden backing board is rotated

Level 2 · node · Correctness · Reversed composition order of hierarchical coordinate transforms

Scenario

A fictional wooden inlay workshop places small motif outlines on a backing board and then positions the entire board on a workbench. Layouts without rotation display correctly, but some motifs are misplaced when the backing board is rotated. Review the coordinate transformation contract and the outline placement flow together.

Requirements

buildPreview({outline, local, board}) returns an array of vertices in workbench coordinates. Each outline point is an integer pair [x,y]. local maps motif coordinates to backing-board coordinates; board maps backing-board coordinates to workbench coordinates. Each frame is {turns, dx, dy}: rotate counterclockwise around the origin by turns quarter turns, then translate. turns ranges from 0 to 3. Preserve vertex order and do not mutate inputs. Return an empty array for an empty outline.

Acceptance criteria

  • Layouts without rotation incorporate both frame translations.
  • Rotating the backing board also rotates the motif's position on the board.
  • Workbench coordinates remain correct when both frames include rotation and translation.
  • Empty outlines and vertex order are preserved without changing input objects.