In line clipping against a rectangular window, if both endpoints of a line…
2012
In line clipping against a rectangular window, if both endpoints of a line segment lie in the same outside region—both left, both right, both above, or both below the window—which statement is true?
Answer: D. The line is trivially rejected and therefore invisible. — ConceptIn rectangular line clipping, each endpoint receives a region code whose bits record whether the point is left, right, above, or below the window. A…
- A.
The line is partially visible and requires clipping.
- B.
The line is completely visible.
- C.
The line cannot be classified by the endpoint codes alone and requires intersection calculations.
- D.
The line is trivially rejected and therefore invisible.
Attempted by 15 students.
Show answer & explanation
Correct answer: D
Concept
In rectangular line clipping, each endpoint receives a region code whose bits record whether the point is left, right, above, or below the window.
A nonzero bitwise AND of the two endpoint codes means that both endpoints lie outside the same boundary. The whole segment then remains in that outside half-plane.
Application
Assign a region code to each endpoint.
Because both endpoints are on the same outside side, their codes share the corresponding left, right, above, or below bit.
Their bitwise AND is therefore nonzero, so no intersection calculation is needed for an inside portion.
Cross-check
If a segment could enter the window, its endpoints would not share a bit for one common outside half-plane; this condition rules that possibility out.
Therefore, the line is trivially rejected and is invisible within the clipping window.