Kite pattern bounding boxes include the unused origin
Level 1 · node · Correctness · Incorrect initialization of coordinate extrema for bounding boxes
Scenario
A fictional kite workshop computes cutting rectangles from pattern vertices. Patterns crossing the origin have correct dimensions, but patterns lying on one side of the workboard include unnecessary margins. Review the coordinate bounds function and the pattern summary.
Requirements
summarize(patterns) receives each pattern's id and points and returns a list of {id, bounds} in input order. For nonempty points, bounds is {minX, minY, maxX, maxY} of the smallest axis-aligned rectangle containing all actual vertices. Coordinates are finite numbers and may be negative. Empty patterns have null bounds. A single point has bounds at that point itself. Do not mutate the original array or entries.
Acceptance criteria
- Return the correct minimum and maximum on each axis for patterns crossing the origin.
- Determine bounds using only actual vertices even when all coordinates are positive or negative.
- Return null for empty patterns and the point's own bounds for single-point patterns.
- Preserve pattern identifiers and input order without modifying the original data.