Successfully reported this slideshow.
Upcoming SlideShare
×

# Cohen sutherland algorithm

Cohen Sutherland Algorithm briefly Explained in easy way

See all

### Related Audiobooks

#### Free with a 30 day trial from Scribd

See all
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

• Be the first to like this

### Cohen sutherland algorithm

1. 1. Computer Graphics (Assignment) By: Farwa Abdul Hannan (12 – CS - 13) Zubaid Khalil (12 – CS – 22) Hassan Ali Khan (12 – CS – 28) Computer Graphics (Assignment) Cohen Sutherland Algorithm: The Cohen–Sutherland algorithm is a computer graphics algorithm used for line clipping. The algorithm divides a two-dimensional space into 9 regions (or a three-dimensional space into 27 regions), and then efficiently determines the lines and portions of lines that are visible in the center region of interest (the viewport). The Algorithm: The algorithm includes, excludes or partially includes the line. Its working has following common cases which are:  Trivial Acceptance  Trivial Rejection  Non-trivial Acceptance  Non-trivial Rejection Steps: The algorithm includes, excludes or partially includes the line based on if:  Both endpoints of the line are in the viewport region (trivial acceptance).  Both endpoints of the line are out of the viewport region (trivial rejection).  If one endpoint of the line is in the viewport region and the other is out of the viewport region chop line at points where is cross the viewport region and continue. In this case non- trivial acceptance/rejection will occur. For the endpoints in the viewport region the algorithm will do the non-trivial acceptance while for the endpoints out of the viewport region the algorithm will do the non-trivial rejection. The trivial acceptance/rejection and non-trivial acceptance/rejection concept is clearly shown in the following diagram.  This algorithm works in both 3D and 2D for clipping regions. An out code is computed for each of the two points in the line. The out code will have four bits for two-dimensional clipping, or six bits in the three-dimensional case. The first bit is set to 1 if the point is above the viewport. The bits in the 2D out code represents: Top, Bottom, Right, and Left. For example the out code 1010 represents a point that is top-right of the viewport. Note that the
2. 2. Computer Graphics (Assignment) By: Farwa Abdul Hannan (12 – CS - 13) Zubaid Khalil (12 – CS – 22) Hassan Ali Khan (12 – CS – 28) Computer Graphics (Assignment) out codes for endpoints of the line must be recalculated on each iteration after the clipping occurs. The numbers shown in the following table are known as out codes.

### Be the first to comment

Cohen Sutherland Algorithm briefly Explained in easy way

Total views

408

On Slideshare

0

From embeds

0

Number of embeds

1

2

Shares

0