{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

# Result 0 trivial reject f cohen sutherland line

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: des together bitwise AND – iif result ≠ 0, trivial reject f Cohen-Sutherland Line Clipping If line cannot be trivially accepted or rejected, subdivide If so that one or both segments can be discarded so Pick an edge that the line crosses (how?) Intersect line with edge (how?) Discard portion on wrong side of edge and assign Discard outcode to new vertex outcode Apply trivial accept/reject tests; repeat if necessary Apply Cohen-Sutherland Line Clipping If line cannot be trivially accepted or rejected, subdivide If so that one or both segments can be discarded so Pick an edge that the line crosses • Check against edges in same order each time – For example: top, bottom, right, left C B A D E Cohen-Sutherland Line Clipping Intersect line with edge (how?) C B A D E Cohen-Sutherland Line Clipping Discard portion on wrong side of edge and assign outcode to new vertex Discard C B A Apply trivial accept/reject tests and repeat if necessary Apply D Viewport Intersection Code • (x1, y1), (x2, y2) intersect with vertical edge at xright – yintersect = y1 + m(xright – x1), m=(y2-y1)/(x2-x1) • (x1, y1), (x2, y2) intersect with horizontal edge at ybottom – xintersect = x1 + (ybottom – y1)/m, m=(y2-y1)/(x2-x1) Cohen-Sutherland Review • Use opcodes to quickly eliminate/include lines – Best algorithm when trivial accepts/rejects are common • Must compute viewport clipping of remaining lines – Non-trivial clipping cost – Redundant clipping of some l...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online