Skip to content

E01 · F07 · EN-009 — Align a fitted shape in its box ​

The uniform fit of F02 (fitInBox) takes a horizontal and a vertical alignment and places the scaled shape at the start, the middle or the end of the room left on each axis (DERIV-regular-polygon-fit step 5, sources from SP-003).

Acceptance criteria ​

  • Given n = 3 in 100 × 100 aligned at the bottom, when it is fitted, then it is (50, 13.39746), (100, 100), (0, 100); at the top, (50, 0), (100, 86.60254), (0, 86.60254).
  • Given n = 4 in 100 × 50 aligned left, when it is fitted, then it is (0, 0), (50, 0), (50, 50), (0, 50); aligned right, (50, 0), (100, 0), (100, 50), (50, 50).
  • Given any alignment at the start or the end of an axis, when a shape is fitted, then every vertex on that side is at 0 or the box size within a rounding error relative to the box, written as that integer (5 decimals).
  • Given the axis the shape fills, when only the alignment on that axis changes, then the points move by a rounding error relative to the box at most (tested at EPSILON × its size), so the written drawing is the same but at a rounding boundary of the 5th decimal.
  • Given the middle on both axes, when a shape is fitted, then the points are those of F02.

Tasks ​

One task = one commit, referenced as EN-009.Tn.