FA-51568 / Raster clipping / Member archive
Cohen sutherland pixel window: iteration budget · case 03
The clip loop assumes one clip per endpoint, so corner-crossing segments needing two clips at each end are reported unresolved.
Case contract
Each command is a segment [x0,y0,x1,y1] whose endpoints are integers or exact decimal/rational strings in pixel-center coordinates. The window is the closed square [0,size-1]x[0,size-1] of pixel centers. Outcodes use strict outside tests (left 1, right 2, below 4, above 8). Both codes zero accepts; a shared bit rejects; otherwise the outside endpoint (endpoint 0 first) is moved to the highest set edge in above, below, right, left order and its code is recomputed from the new point; a clip against an edge parallel to the segment is treated as a rejection. At most five iterations are allowed; an unresolved or rejected segment returns None. Accepted endpoints round half-up to integer pixels.
Why this case matters
Raster clipping decides which pixels a primitive may touch; a single wrong clip decision writes outside the target or scissor, or silently drops visible coverage.
One recorded failure
Sample boundary fixtureThis sample comes from the broken implementation of a controlled reproducer.
| Boundary fixture | Actual | Expected | Outcome |
|---|---|---|---|
| explicit case 1 | [null] | [[0, 2, 7, 2]] | Failed |
MEMBER ARCHIVE
The complete case is available to members.
This record includes three runnable implementations, regression fixtures, execution results, and source hashes.
Member access is invitation-based. Sign in with your invited account to inspect the sources.
Sign in to the archive ↗