SlideShare a Scribd company logo
10
Most read
15
Most read
16
Most read
Cohen-Sutherland Line Clipping Algorithm
Group 3
Cohen-Sutherland Line
Clipping Algorithm
Hosted By
M.M. Arifin Ferdous Joy 131-15-2614
Md. Touhidul Hasan Shadi 132-15-2680
Maruf Abdullah (Rion) 132-15-2703
Introduction
When drawing a 2D line on screen, it might happen
that one or both of the endpoints are outside the
screen while a part of the line should still be visible.
In that case, an efficient algorithm is needed to find
two new endpoints that are on the edges on the
screen, so that the part of the line that's visible can
now be drawn. This way, all those points of the line
outside the screen are clipped away and you don't
need to waste any execution time on them.
A good clipping algorithm is the Cohen-Sutherland
algorithm for this solution.
Here are a few cases, where the black rectangle
represents the screen, in red are the old endpoints, and
in blue the ones after clipping:
Case A: Both end-points are inside the screen, so no
clipping needed.
CASE A
Case B: One end-point outside the screen, that one had to be
clipped.
Case C: both endpoint are outside the screen, and no part of
the line is visible, don't draw it at all.
Case D: both endpoint are outside the screen, and a part of
the line is visible, clip both endpoints and draw it.
CASE B CASE C CASE D
Cohen Sutherland Clipping
Algorithm
Now we will learn what is Cohen Sutherland
Clipping Algorithm and how it works.
This algorithm clips a line to the clipping
rectangle. It concerns itself with performing
the simple cases quickly.
In this algorithm it divides lines & edges into
2 cases.
1) Trivially Accept and
2) Trivially Reject.
Conditions of Trivially Accept
Xmin ≤ X ≤ Xmax
Ymin ≤ Y ≤ Ymax
Lines fulfill this conditions then we will mark
those lines as trivially accept.
Ymax
Ymin
Xmin Xmax
Conditions of Trivially Reject
 X0 < Xmin & X1 < Xmin or
Y0 < Ymin & Y1 < Ymin
X0 > Xmax & X1 > Xmax or
Y0 > Ymax & Y1 > Ymax
Question Arrives
We must have a question now??
A
B
Then we will move forward for solve this ……..
The algorithm divides the 2D space in 9 regions:
This is also known as ABRL CODE
Figure: 2D space in 9 regions
 The center region is the screen or Window
Position (0000).
 If the region is above the screen, the first bit
is 1.
 If the region is below the screen, the second
bit is 1.
 If the region is to the right of the screen, the
third bit is 1.
 If the region is to the left of the screen, the
fourth bit is 1.
A (0100) B (0010)
AND Operation
Then get the new point C (0000)
C (0000) B (0010)
AND Operation
Then get the new point D (0000)
Then we have the final line after clipping is CD
Handling Similar Situations
If similar problems arrive then we have to clip
those according to mentioned method.
Some examples of similar situations
Any Questions??
Cohen-Sutherland Line Clipping Algorithm

More Related Content

PPTX
Cohen sutherland line clipping
PPTX
Bezier Curve
PPTX
Use case diagram
PPTX
Color models
PPTX
sutherland- Hodgeman Polygon clipping
PPTX
DATA Types
PPT
Logic (PROPOSITIONS)
PPT
Social Network Analysis
Cohen sutherland line clipping
Bezier Curve
Use case diagram
Color models
sutherland- Hodgeman Polygon clipping
DATA Types
Logic (PROPOSITIONS)
Social Network Analysis

What's hot (20)

PPT
Liang barsky Line Clipping Algorithm
PPTX
The sutherland hodgeman polygon clipping algorithm
PPT
Visible surface detection in computer graphic
PPT
2D transformation (Computer Graphics)
PDF
Computer graphics curves and surfaces (1)
PPTX
Clipping computer graphics
PPTX
Window to Viewport Transformation in Computer Graphics with.pptx
PPTX
Weiler atherton
PDF
Unit 3
PPTX
Output primitives in Computer Graphics
PPTX
Graphics_3D viewing
PPTX
Clipping in Computer Graphics
PPTX
Frame buffer
PPTX
Projection In Computer Graphics
PDF
3D Transformation
PPTX
Graphics software and standards
PPTX
Projections.pptx
PPTX
2D viewing & clipping
PPT
Polygon clipping
PPTX
Introduction to computer graphics
Liang barsky Line Clipping Algorithm
The sutherland hodgeman polygon clipping algorithm
Visible surface detection in computer graphic
2D transformation (Computer Graphics)
Computer graphics curves and surfaces (1)
Clipping computer graphics
Window to Viewport Transformation in Computer Graphics with.pptx
Weiler atherton
Unit 3
Output primitives in Computer Graphics
Graphics_3D viewing
Clipping in Computer Graphics
Frame buffer
Projection In Computer Graphics
3D Transformation
Graphics software and standards
Projections.pptx
2D viewing & clipping
Polygon clipping
Introduction to computer graphics
Ad

Similar to Cohen-Sutherland Line Clipping Algorithm (20)

PPTX
Cohen sutherland line clipping algorithm
PPTX
Line clipping algorithm (Detailed)
PPTX
PPTX
Clipping ( Cohen-Sutherland Algorithm )
DOCX
Cohen sutherland algorithm
PPTX
PPT
99995327.ppt
PPT
Line clipping
PPT
Clipping
PPT
Lecture1616_16827_2D Clipping.ppt
PPT
Windowing clipping
PPTX
Lect 5 2d clipping
PPTX
Clipping
PPTX
Clipping 22
PPTX
Clipping 22
PPTX
line clipping
PPT
To dimensional clipping brief notes.ppt
PPTX
kgv.pptx
PDF
Unit-IV Windowing and Clipping.pdf
PPTX
Clipping
Cohen sutherland line clipping algorithm
Line clipping algorithm (Detailed)
Clipping ( Cohen-Sutherland Algorithm )
Cohen sutherland algorithm
99995327.ppt
Line clipping
Clipping
Lecture1616_16827_2D Clipping.ppt
Windowing clipping
Lect 5 2d clipping
Clipping
Clipping 22
Clipping 22
line clipping
To dimensional clipping brief notes.ppt
kgv.pptx
Unit-IV Windowing and Clipping.pdf
Clipping
Ad

Recently uploaded (20)

PDF
Operating System & Kernel Study Guide-1 - converted.pdf
PPTX
web development for engineering and engineering
PPTX
additive manufacturing of ss316l using mig welding
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Welding lecture in detail for understanding
PPTX
UNIT 4 Total Quality Management .pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Construction Project Organization Group 2.pptx
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PPTX
CH1 Production IntroductoryConcepts.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
PPTX
Internet of Things (IOT) - A guide to understanding
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
PPTX
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
PPTX
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
PPTX
UNIT-1 - COAL BASED THERMAL POWER PLANTS
Operating System & Kernel Study Guide-1 - converted.pdf
web development for engineering and engineering
additive manufacturing of ss316l using mig welding
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Welding lecture in detail for understanding
UNIT 4 Total Quality Management .pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Construction Project Organization Group 2.pptx
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
CH1 Production IntroductoryConcepts.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
Model Code of Practice - Construction Work - 21102022 .pdf
SM_6th-Sem__Cse_Internet-of-Things.pdf IOT
Internet of Things (IOT) - A guide to understanding
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
FINAL REVIEW FOR COPD DIANOSIS FOR PULMONARY DISEASE.pptx
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
Infosys Presentation by1.Riyan Bagwan 2.Samadhan Naiknavare 3.Gaurav Shinde 4...
CARTOGRAPHY AND GEOINFORMATION VISUALIZATION chapter1 NPTE (2).pptx
UNIT-1 - COAL BASED THERMAL POWER PLANTS

Cohen-Sutherland Line Clipping Algorithm

  • 3. Hosted By M.M. Arifin Ferdous Joy 131-15-2614 Md. Touhidul Hasan Shadi 132-15-2680 Maruf Abdullah (Rion) 132-15-2703
  • 4. Introduction When drawing a 2D line on screen, it might happen that one or both of the endpoints are outside the screen while a part of the line should still be visible. In that case, an efficient algorithm is needed to find two new endpoints that are on the edges on the screen, so that the part of the line that's visible can now be drawn. This way, all those points of the line outside the screen are clipped away and you don't need to waste any execution time on them. A good clipping algorithm is the Cohen-Sutherland algorithm for this solution.
  • 5. Here are a few cases, where the black rectangle represents the screen, in red are the old endpoints, and in blue the ones after clipping: Case A: Both end-points are inside the screen, so no clipping needed. CASE A
  • 6. Case B: One end-point outside the screen, that one had to be clipped. Case C: both endpoint are outside the screen, and no part of the line is visible, don't draw it at all. Case D: both endpoint are outside the screen, and a part of the line is visible, clip both endpoints and draw it. CASE B CASE C CASE D
  • 7. Cohen Sutherland Clipping Algorithm Now we will learn what is Cohen Sutherland Clipping Algorithm and how it works. This algorithm clips a line to the clipping rectangle. It concerns itself with performing the simple cases quickly.
  • 8. In this algorithm it divides lines & edges into 2 cases. 1) Trivially Accept and 2) Trivially Reject.
  • 9. Conditions of Trivially Accept Xmin ≤ X ≤ Xmax Ymin ≤ Y ≤ Ymax Lines fulfill this conditions then we will mark those lines as trivially accept. Ymax Ymin Xmin Xmax
  • 10. Conditions of Trivially Reject  X0 < Xmin & X1 < Xmin or Y0 < Ymin & Y1 < Ymin X0 > Xmax & X1 > Xmax or Y0 > Ymax & Y1 > Ymax
  • 11. Question Arrives We must have a question now?? A B Then we will move forward for solve this ……..
  • 12. The algorithm divides the 2D space in 9 regions: This is also known as ABRL CODE Figure: 2D space in 9 regions
  • 13.  The center region is the screen or Window Position (0000).  If the region is above the screen, the first bit is 1.  If the region is below the screen, the second bit is 1.  If the region is to the right of the screen, the third bit is 1.  If the region is to the left of the screen, the fourth bit is 1.
  • 14. A (0100) B (0010) AND Operation Then get the new point C (0000)
  • 15. C (0000) B (0010) AND Operation Then get the new point D (0000) Then we have the final line after clipping is CD
  • 16. Handling Similar Situations If similar problems arrive then we have to clip those according to mentioned method. Some examples of similar situations