FA-51543 / Raster clipping / Member archive
Cohen sutherland pixel window: outside code merge · case 03
The edge to clip is chosen from the union of both outcodes, so an intersection computed for one endpoint is written into the other endpoint.
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 12 | [null] | [[0, 1, 7, 7]] | 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 ↗