In Cohen-Sutherland clipping, it assigns outcodes to the points on lines that are drawn to specify their orientation relative to the clipping window.

In the diagram below, I'm confused on what outcodes that would be assigned to p1, p2, p3, p4? Can someone explain? enter image description here

New contributor
user9778 is a new contributor to this site. Take care in asking for clarification, commenting, and answering. Check out our Code of Conduct.
up vote 2 down vote accepted

The diagram on the Wikipedia entry for Cohen-Sutherland Clipping explains it pretty well:

        left    central right
top     1001    1000    1010
central 0001    0000    0010
bottom  0101    0100    0110

So in your example, p1 would be left, central, so its code would be 0001.

p2 would be central, bottom, so 0100

p3 would be central, central, so 0000

p4 would be central, top, so 1000

Your Answer

user9778 is a new contributor. Be nice, and check out our Code of Conduct.

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.