SlideShare a Scribd company logo
1 of 18
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

What's hot

2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphicsKALESHWAR KUMAR
 
Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfacesMohd Arif
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithmAparna Joshi
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 
Cohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marksCohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marksRehan Khan
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphicanku2266
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)Timbal Mayank
 
Unit 3
Unit 3Unit 3
Unit 3ypnrao
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithmPooja Dixit
 
Video display devices
Video display devicesVideo display devices
Video display devicesMohd Arif
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"Ankit Surti
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.Mohd Arif
 
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Mani Kanth
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphicsSafayet Hossain
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer GraphicsSanu Philip
 

What's hot (20)

2 d viewing computer graphics
2 d viewing computer graphics2 d viewing computer graphics
2 d viewing computer graphics
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Cohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marksCohen and Sutherland Algorithm for 7-8 marks
Cohen and Sutherland Algorithm for 7-8 marks
 
BRESENHAM’S LINE DRAWING ALGORITHM
BRESENHAM’S  LINE DRAWING ALGORITHMBRESENHAM’S  LINE DRAWING ALGORITHM
BRESENHAM’S LINE DRAWING ALGORITHM
 
Visible surface detection in computer graphic
Visible surface detection in computer graphicVisible surface detection in computer graphic
Visible surface detection in computer graphic
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
Unit 3
Unit 3Unit 3
Unit 3
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"COMPUTER GRAPHICS-"Projection"
COMPUTER GRAPHICS-"Projection"
 
Line drawing algo.
Line drawing algo.Line drawing algo.
Line drawing algo.
 
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
 
Anti- aliasing computer graphics
Anti- aliasing computer graphicsAnti- aliasing computer graphics
Anti- aliasing computer graphics
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
3 d display methods
3 d display methods3 d display methods
3 d display methods
 

Similar to Cohen-Sutherland Line Clipping Algorithm

Similar to Cohen-Sutherland Line Clipping Algorithm (20)

Cohen sutherland line clipping algorithm
Cohen sutherland line clipping algorithmCohen sutherland line clipping algorithm
Cohen sutherland line clipping algorithm
 
Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)Line clipping algorithm (Detailed)
Line clipping algorithm (Detailed)
 
Clipping
ClippingClipping
Clipping
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
Cohen sutherland algorithm
Cohen sutherland algorithmCohen sutherland algorithm
Cohen sutherland algorithm
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
Line clipping
Line clippingLine clipping
Line clipping
 
Clipping
ClippingClipping
Clipping
 
Lecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.pptLecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.ppt
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 
line clipping
line clipping line clipping
line clipping
 
kgv.pptx
kgv.pptxkgv.pptx
kgv.pptx
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
Clipping
ClippingClipping
Clipping
 
Computer Graphics - clipping
Computer Graphics - clippingComputer Graphics - clipping
Computer Graphics - clipping
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping
 

Recently uploaded

Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating SystemRashmi Bhat
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTSneha Padhiar
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingBootNeck1
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxsiddharthjain2303
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfChristianCDAM
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating SystemRashmi Bhat
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSneha Padhiar
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONjhunlian
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionSneha Padhiar
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxStephen Sitton
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdfAkritiPradhan2
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmDeepika Walanjkar
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptJohnWilliam111370
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESkarthi keyan
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosVictor Morales
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating SystemRashmi Bhat
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdfsahilsajad201
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewsandhya757531
 

Recently uploaded (20)

Input Output Management in Operating System
Input Output Management in Operating SystemInput Output Management in Operating System
Input Output Management in Operating System
 
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENTFUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
FUNCTIONAL AND NON FUNCTIONAL REQUIREMENT
 
System Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event SchedulingSystem Simulation and Modelling with types and Event Scheduling
System Simulation and Modelling with types and Event Scheduling
 
Energy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptxEnergy Awareness training ppt for manufacturing process.pptx
Energy Awareness training ppt for manufacturing process.pptx
 
Ch10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdfCh10-Global Supply Chain - Cadena de Suministro.pdf
Ch10-Global Supply Chain - Cadena de Suministro.pdf
 
Main Memory Management in Operating System
Main Memory Management in Operating SystemMain Memory Management in Operating System
Main Memory Management in Operating System
 
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATIONSOFTWARE ESTIMATION COCOMO AND FP CALCULATION
SOFTWARE ESTIMATION COCOMO AND FP CALCULATION
 
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTIONTHE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
THE SENDAI FRAMEWORK FOR DISASTER RISK REDUCTION
 
Cost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based questionCost estimation approach: FP to COCOMO scenario based question
Cost estimation approach: FP to COCOMO scenario based question
 
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
Stork Webinar | APM Transformational planning, Tool Selection & Performance T...
 
Turn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptxTurn leadership mistakes into a better future.pptx
Turn leadership mistakes into a better future.pptx
 
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdfDEVICE DRIVERS AND INTERRUPTS  SERVICE MECHANISM.pdf
DEVICE DRIVERS AND INTERRUPTS SERVICE MECHANISM.pdf
 
Designing pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptxDesigning pile caps according to ACI 318-19.pptx
Designing pile caps according to ACI 318-19.pptx
 
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithmComputer Graphics Introduction, Open GL, Line and Circle drawing algorithm
Computer Graphics Introduction, Open GL, Line and Circle drawing algorithm
 
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.pptROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
ROBOETHICS-CCS345 ETHICS AND ARTIFICIAL INTELLIGENCE.ppt
 
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTESCME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
CME 397 - SURFACE ENGINEERING - UNIT 1 FULL NOTES
 
KCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitosKCD Costa Rica 2024 - Nephio para parvulitos
KCD Costa Rica 2024 - Nephio para parvulitos
 
Virtual memory management in Operating System
Virtual memory management in Operating SystemVirtual memory management in Operating System
Virtual memory management in Operating System
 
Robotics Group 10 (Control Schemes) cse.pdf
Robotics Group 10  (Control Schemes) cse.pdfRobotics Group 10  (Control Schemes) cse.pdf
Robotics Group 10 (Control Schemes) cse.pdf
 
Artificial Intelligence in Power System overview
Artificial Intelligence in Power System overviewArtificial Intelligence in Power System overview
Artificial Intelligence in Power System overview
 

Cohen-Sutherland Line Clipping Algorithm

  • 1.
  • 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