SlideShare a Scribd company logo
3
Most read
13
Most read
15
Most read
Clipping Algorithms
Cohen & Hodgeman algos
Presenter Rohit Jain
Line Clipping :-
◦ Windowing
◦ Concepts
◦ Clipping
◦ Introduction
◦ Brute Force
◦ Cohen-Sutherland Clipping Algorithm
Area Clipping :-
◦ Sutherland-Hodgman Area Clipping Algorithm
A scene is made up of a collection of objects specified in
world coordinates
World Coordinates
When we display a scene only those objects within a
particular window are displayed
wymax
wymin
wxmin wxmax
Window
World Coordinates
Because drawing things to a display takes time we
clip everything outside the window
wymax
wymin
wxmin wxmax
World Coordinates
Window
For the image below consider which lines and points
should be kept and which ones should be clipped
wymax
wymin
wxmin wxmax
P1
Window
P6
P5
P3
P7
P10
P9
P4
P
2
P
8
Easy - a point (x,y) is not clipped if:
wxmin≤ x ≤ wxmax AND wymin≤ y ≤ wymax
otherwise it is clipped
wymax
wymin
wxmin wxmax
Window
P1
P2
P5
P10
P4
P8
Clipped
Points Within the Window
are Not Clipped
P9
Clipped
Clipped
Clipped
P7
HARDER - EXAMINE THE END-POINTS OF EACH LINE
TO SEE IF THEY ARE IN THE WINDOW OR NOT
Situation Solution Example
Both end-points inside
the window
Don’t clip
One end-point inside
the window, one
outside
Must clip
Both end-points
outside the window
Don’t know!
◦ Don’t clip lines with both
end-points within the
window
◦ For lines with one end-
point inside the window
and one end-point
outside, calculate the
intersection point (using the equation of the line) and
clip from this point out
◦ For lines with both end-points
outside the window test the
line for intersection with all of
the window boundaries, and
clip appropriately
• An efficient line clipping algorithm…
• The key advantage of the algorithm is that it
vastly reduces the number of line intersections
that must be calculated…
Cohen – Sutherland: Clipping Algorithm
0001
0000
Window
0010
0101 0100 0110
World space is divided into regions based on the
window boundaries
◦ Each region has a unique four bit region code
◦ Region codes indicate the position of the regions
with respect to the window
1001 1000 1010
Top below Right Left
3 2 1 0
Region Code Legend
EVERY END-POINT IS LABELLED WITH THE
APPROPRIATE REGION CODE
wymax
wymin
wxmin wxmax
Window
P3 [0001]
P6 [0000]
P5 [0000]
P7 [0001]
P10 [0100]
P9 [0000]
P4 [1000]
P8 [0010]
P12 [0010]
P11 [1010]
P13 [0101] P14 [0110]
Cohen – Sutherland: Lines in the window
• Lines completely contained within the window boundaries have region code [0000] for
both end-points so are not clipped
wxmin wxmax
wymax
wymin
Window
P3 [0001]
P6 [0000]
P5 [0000]
P7 [0001]
P10 [0100]
P9 [0000]
P4 [1000]
P8 [0010]
P12 [0010]
P11 [1010]
P13 [0101] P14 [0110]
Any lines with a common set bit in the region codes of
both end-points can be clipped
– The AND operation can efficiently check this
wymax
wymin
wxmin wxmax
Window
P3 [0001]
P6 [0000]
P5 [0000]
P7 [0001]
P10 [0100]
P9 [0000]
4P [1000]
P8 [0010]
P12 [0010]
11P [1010]
P13 [0101] P14 [0110]
Cohen – Sutherland: Lines Outside the window
Similarly to lines, areas must
be clipped to a window
boundary
Consideration must be taken
as to which portions of the
area must be clipped
A technique for clipping areas developed by
Sutherland & Hodgman
Put simply the polygon is clipped by comparing
it against each boundary in turn
Original Area Clip Left Clip Right Clip Top Clip Bottom
Sutherland – hodgman Area clipping
Algorithm
To clip an area against an individual boundary:
◦ Consider each vertex in turn against the boundary
◦ Vertices inside the boundary are saved for clipping against
the next boundary
◦ Vertices outside the boundary are clipped
◦ If we proceed from a point inside the boundary to one
outside, the intersection of the line with the boundary is
saved
◦ If we cross from the outside to the inside intersection point
and the vertex are saved
Each example shows the point
being processed (P) and the
previous point (S) Saved points
define
area clipped to the boundary in
question
S
Save P
S
Point I
P
S
No Points Saved
P
Save Points I & P
Clipping concave areas can be a little more tricky as often superfluous
lines must be removed
urve
Clipping circles requires more work
• Objects within a scene must be clipped to
display the scene in a window…
• Because there are can be so many objects
clipping must be extremely efficient…
• The Cohen-Sutherland algorithm can be used
for line clipping…
• The Sutherland-Hodgman algorithm can be
used for area clipping…
Sutherlands Cohen and Hodgeman algorithms

More Related Content

PPTX
Clipping in Computer Graphics
PPTX
Circle generation algorithm
PPTX
The sutherland hodgeman polygon clipping algorithm
PPTX
Weiler atherton
PPTX
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
PPTX
Mid point circle algorithm
PPTX
Raster scan systems with video controller and display processor
Clipping in Computer Graphics
Circle generation algorithm
The sutherland hodgeman polygon clipping algorithm
Weiler atherton
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Mid point circle algorithm
Raster scan systems with video controller and display processor

What's hot (20)

PDF
Unit-IV Windowing and Clipping.pdf
PPT
Seed filling algorithm
PPTX
Cyrus beck line clipping algorithm
PPTX
Bootstrapping in Compiler
PPTX
2D viewing & clipping
PPTX
Clipping
PPTX
Window to Viewport Transformation in Computer Graphics with.pptx
PPTX
2 d viewing computer graphics
PDF
Unit 3
PPTX
sutherland- Hodgeman Polygon clipping
PPTX
Cohen sutherland line clipping
PPTX
Clipping
PPTX
Curve clipping
PPTX
Composite transformation
DOCX
Bezier Curve in Computer Graphics.docx
PPTX
Clipping computer graphics
PPTX
Character generation techniques
PPT
Quadric surfaces
PPT
applications of computer graphics
DOC
Digital image processing questions
Unit-IV Windowing and Clipping.pdf
Seed filling algorithm
Cyrus beck line clipping algorithm
Bootstrapping in Compiler
2D viewing & clipping
Clipping
Window to Viewport Transformation in Computer Graphics with.pptx
2 d viewing computer graphics
Unit 3
sutherland- Hodgeman Polygon clipping
Cohen sutherland line clipping
Clipping
Curve clipping
Composite transformation
Bezier Curve in Computer Graphics.docx
Clipping computer graphics
Character generation techniques
Quadric surfaces
applications of computer graphics
Digital image processing questions
Ad

Similar to Sutherlands Cohen and Hodgeman algorithms (20)

PPTX
Clipping ( Cohen-Sutherland Algorithm )
PPTX
Lect 5 2d clipping
PPTX
Clipping in 2 d
PPT
99995327.ppt
PPTX
PPTX
ibuib.pptx
PPTX
kgv.pptx
PPTX
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
PPT
To dimensional clipping brief notes.ppt
PPT
Cohen and Sutherland Algorithm for 7-8 marks
PPT
Windowing clipping
PPTX
Unit2- line clipping.pptx
PPTX
Computer Graphics - Windowing and Clipping
PPT
Lecture1616_16827_2D Clipping.ppt
PPTX
line clipping
PPT
Clipping
PPT
Line clipping
PPTX
Line clipping algorithm (Detailed)
PPTX
Group 6 Presentation - Copy.pptx
PPTX
Group 5 Presentation.pptx
Clipping ( Cohen-Sutherland Algorithm )
Lect 5 2d clipping
Clipping in 2 d
99995327.ppt
ibuib.pptx
kgv.pptx
clippiNG COMPUTER GRAPHICS A NEW ERA.pptx
To dimensional clipping brief notes.ppt
Cohen and Sutherland Algorithm for 7-8 marks
Windowing clipping
Unit2- line clipping.pptx
Computer Graphics - Windowing and Clipping
Lecture1616_16827_2D Clipping.ppt
line clipping
Clipping
Line clipping
Line clipping algorithm (Detailed)
Group 6 Presentation - Copy.pptx
Group 5 Presentation.pptx
Ad

More from Rohit Jain (9)

PPTX
VR - Virtual reality
PPTX
Social media
PPTX
Lifi - Light Fidelity
PPTX
File system and Deadlocks
PPTX
Artificial intelligence
PPTX
Introduction about Processors
PPTX
Overview On water
PPTX
Advance peripheral devices
PPTX
Big Data
VR - Virtual reality
Social media
Lifi - Light Fidelity
File system and Deadlocks
Artificial intelligence
Introduction about Processors
Overview On water
Advance peripheral devices
Big Data

Recently uploaded (20)

PDF
Model Code of Practice - Construction Work - 21102022 .pdf
PDF
Embodied AI: Ushering in the Next Era of Intelligent Systems
DOCX
573137875-Attendance-Management-System-original
PPTX
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
DOCX
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
PDF
Well-logging-methods_new................
PDF
Automation-in-Manufacturing-Chapter-Introduction.pdf
PPT
Project quality management in manufacturing
PDF
PPT on Performance Review to get promotions
PDF
R24 SURVEYING LAB MANUAL for civil enggi
PDF
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
PPTX
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
PDF
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
PPTX
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
PDF
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
PDF
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
PPTX
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PDF
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
PPTX
Welding lecture in detail for understanding
PPTX
UNIT 4 Total Quality Management .pptx
Model Code of Practice - Construction Work - 21102022 .pdf
Embodied AI: Ushering in the Next Era of Intelligent Systems
573137875-Attendance-Management-System-original
MCN 401 KTU-2019-PPE KITS-MODULE 2.pptx
ASol_English-Language-Literature-Set-1-27-02-2023-converted.docx
Well-logging-methods_new................
Automation-in-Manufacturing-Chapter-Introduction.pdf
Project quality management in manufacturing
PPT on Performance Review to get promotions
R24 SURVEYING LAB MANUAL for civil enggi
The CXO Playbook 2025 – Future-Ready Strategies for C-Suite Leaders Cerebrai...
Engineering Ethics, Safety and Environment [Autosaved] (1).pptx
TFEC-4-2020-Design-Guide-for-Timber-Roof-Trusses.pdf
MET 305 2019 SCHEME MODULE 2 COMPLETE.pptx
BMEC211 - INTRODUCTION TO MECHATRONICS-1.pdf
keyrequirementskkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkkk
Recipes for Real Time Voice AI WebRTC, SLMs and Open Source Software.pptx
PRIZ Academy - 9 Windows Thinking Where to Invest Today to Win Tomorrow.pdf
Welding lecture in detail for understanding
UNIT 4 Total Quality Management .pptx

Sutherlands Cohen and Hodgeman algorithms

  • 1. Clipping Algorithms Cohen & Hodgeman algos Presenter Rohit Jain
  • 2. Line Clipping :- ◦ Windowing ◦ Concepts ◦ Clipping ◦ Introduction ◦ Brute Force ◦ Cohen-Sutherland Clipping Algorithm Area Clipping :- ◦ Sutherland-Hodgman Area Clipping Algorithm
  • 3. A scene is made up of a collection of objects specified in world coordinates World Coordinates
  • 4. When we display a scene only those objects within a particular window are displayed wymax wymin wxmin wxmax Window World Coordinates
  • 5. Because drawing things to a display takes time we clip everything outside the window wymax wymin wxmin wxmax World Coordinates Window
  • 6. For the image below consider which lines and points should be kept and which ones should be clipped wymax wymin wxmin wxmax P1 Window P6 P5 P3 P7 P10 P9 P4 P 2 P 8
  • 7. Easy - a point (x,y) is not clipped if: wxmin≤ x ≤ wxmax AND wymin≤ y ≤ wymax otherwise it is clipped wymax wymin wxmin wxmax Window P1 P2 P5 P10 P4 P8 Clipped Points Within the Window are Not Clipped P9 Clipped Clipped Clipped P7
  • 8. HARDER - EXAMINE THE END-POINTS OF EACH LINE TO SEE IF THEY ARE IN THE WINDOW OR NOT Situation Solution Example Both end-points inside the window Don’t clip One end-point inside the window, one outside Must clip Both end-points outside the window Don’t know!
  • 9. ◦ Don’t clip lines with both end-points within the window ◦ For lines with one end- point inside the window and one end-point outside, calculate the intersection point (using the equation of the line) and clip from this point out
  • 10. ◦ For lines with both end-points outside the window test the line for intersection with all of the window boundaries, and clip appropriately
  • 11. • An efficient line clipping algorithm… • The key advantage of the algorithm is that it vastly reduces the number of line intersections that must be calculated… Cohen – Sutherland: Clipping Algorithm
  • 12. 0001 0000 Window 0010 0101 0100 0110 World space is divided into regions based on the window boundaries ◦ Each region has a unique four bit region code ◦ Region codes indicate the position of the regions with respect to the window 1001 1000 1010 Top below Right Left 3 2 1 0 Region Code Legend
  • 13. EVERY END-POINT IS LABELLED WITH THE APPROPRIATE REGION CODE wymax wymin wxmin wxmax Window P3 [0001] P6 [0000] P5 [0000] P7 [0001] P10 [0100] P9 [0000] P4 [1000] P8 [0010] P12 [0010] P11 [1010] P13 [0101] P14 [0110]
  • 14. Cohen – Sutherland: Lines in the window • Lines completely contained within the window boundaries have region code [0000] for both end-points so are not clipped wxmin wxmax wymax wymin Window P3 [0001] P6 [0000] P5 [0000] P7 [0001] P10 [0100] P9 [0000] P4 [1000] P8 [0010] P12 [0010] P11 [1010] P13 [0101] P14 [0110]
  • 15. Any lines with a common set bit in the region codes of both end-points can be clipped – The AND operation can efficiently check this wymax wymin wxmin wxmax Window P3 [0001] P6 [0000] P5 [0000] P7 [0001] P10 [0100] P9 [0000] 4P [1000] P8 [0010] P12 [0010] 11P [1010] P13 [0101] P14 [0110] Cohen – Sutherland: Lines Outside the window
  • 16. Similarly to lines, areas must be clipped to a window boundary Consideration must be taken as to which portions of the area must be clipped
  • 17. A technique for clipping areas developed by Sutherland & Hodgman Put simply the polygon is clipped by comparing it against each boundary in turn Original Area Clip Left Clip Right Clip Top Clip Bottom Sutherland – hodgman Area clipping Algorithm
  • 18. To clip an area against an individual boundary: ◦ Consider each vertex in turn against the boundary ◦ Vertices inside the boundary are saved for clipping against the next boundary ◦ Vertices outside the boundary are clipped ◦ If we proceed from a point inside the boundary to one outside, the intersection of the line with the boundary is saved ◦ If we cross from the outside to the inside intersection point and the vertex are saved
  • 19. Each example shows the point being processed (P) and the previous point (S) Saved points define area clipped to the boundary in question S Save P S Point I P S No Points Saved P Save Points I & P
  • 20. Clipping concave areas can be a little more tricky as often superfluous lines must be removed urve Clipping circles requires more work
  • 21. • Objects within a scene must be clipped to display the scene in a window… • Because there are can be so many objects clipping must be extremely efficient… • The Cohen-Sutherland algorithm can be used for line clipping… • The Sutherland-Hodgman algorithm can be used for area clipping…