O slideshow foi denunciado.
Utilizamos seu perfil e dados de atividades no LinkedIn para personalizar e exibir anúncios mais relevantes. Altere suas preferências de anúncios quando desejar.
Computer Graphics (Assignment) By: Farwa Abdul Hannan (12 – CS - 13)
Zubaid Khalil (12 – CS – 22)
Hassan Ali Khan (12 – CS...
Computer Graphics (Assignment) By: Farwa Abdul Hannan (12 – CS - 13)
Zubaid Khalil (12 – CS – 22)
Hassan Ali Khan (12 – CS...
Próximos SlideShares
Carregando em…5
×

Cohen sutherland algorithm

Cohen Sutherland Algorithm briefly Explained in easy way

  • Seja o primeiro a comentar

  • Seja a primeira pessoa a gostar disto

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.

×