Skip to content

E01 · F02 — Regular polygon with corner radius ​

Benefit hypothesis: the designer types a number of corners and a box, and gets the largest regular polygon fitting it, with a flat base, optionally rounded.

Refined with the Product Owner on 2026-10-09 (Q18 settled, Q19 settled at 12 after research 0004, maximal radius accepted, shape selector in the playground).

Acceptance criteria ​

  1. An n-gon (integer 3 ≤ n ≤ 12, Q19) fits a w × h box uniformly, regular, with a flat base, centered, reaching w or h or both (DERIV-regular-polygon-fit); any other number of corners and negative sizes are refused (Q15).
  2. A global corner radius rounds every corner, clamped as in F01 (ADR-0007); the requested value is kept and the effective value is shown when they differ (Q8); at the maximal radius the polygon is its inscribed circle: a hexagon in 100 × 100 becomes a circle of diameter 86.6.
  3. Output coordinates have at most 5 decimals (Q10); the contour is clockwise, from the topmost vertex, the leftmost on a tie (Q11, Q18). Since F08 (Q18 amended), a regular polygon starts at the right end of its base instead of its topmost vertex.
  4. In the playground, a shape selector switches between rectangle and polygon: width, height and radius are kept, the number of corners appears for the polygon only.
  5. In the playground, a width, height or radius above 100 000 becomes 100 000; the library keeps no upper limit (Q20, added 2026-10-09 at the Product Owner's request).

Stories ​

In delivery order.

IDTypeTitleStatus
SP-002SpikeResearch for F02done
EN-008EnablerUnit regular polygon with a flat basedone
US-005User storyRegular polygon contour fitted in its boxdone
CHK-002CheckpointCheckpoint in the middle of F02done
US-006User storyRound the polygon's cornersdone
US-007User storyChoose rectangle or polygon in the playgrounddone
AUD-002AuditAudit F02: regular polygon with corner radiusdone
US-008User storyCap the sizes typed in the playground at 100 000done
VAL-002ValidationValidate F02 on the reference casesdone

Feature plan ​

Acceptance criterionRealized byVerified by
1 — uniform fit, flat base, refused valuesSP-002 (Q19), EN-008, US-005[F02.AC1] tests (EN-008, US-005, US-007), VAL-002
2 — global radius, inscribed circle at mostUS-006 (F01 geometry reused)[F02.AC2] tests (US-006, US-007), US-007 card, VAL-002
3 — precision, orientation, starting vertexEN-008, US-005[F02.AC3] tests (EN-008, US-005, AUD-002: output decimals)
4 — shape selector in the playgroundUS-007[F02.AC4] playground tests (US-007), VAL-002
5 — sizes capped in the playgroundUS-008[F02.AC5] playground tests (US-008), VAL-002