SlideShare ist ein Scribd-Unternehmen logo
1 von 22
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

Weitere ähnliche Inhalte

Was ist angesagt?

Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clippingMani Kanth
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer GraphicsSanu Philip
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmMani Kanth
 
Cohen sutherland line clipping algorithm
Cohen sutherland line clipping algorithmCohen sutherland line clipping algorithm
Cohen sutherland line clipping algorithmTawfiq Ahmed
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformationAnkit Garg
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics Barani Tharan
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithmKKARUNKARTHIK
 
Back face detection
Back face detectionBack face detection
Back face detectionPooja Dixit
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfAmol Gaikwad
 
Curve and text clipping
Curve and text clippingCurve and text clipping
Curve and text clippingArvind Kumar
 
Color Models Computer Graphics
Color Models Computer GraphicsColor Models Computer Graphics
Color Models Computer Graphicsdhruv141293
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesOmprakash Chauhan
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unitaravindangc
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfacesAnkur Kumar
 

Was ist angesagt? (20)

Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithm
 
Curve clipping
Curve clippingCurve clipping
Curve clipping
 
Cohen sutherland line clipping algorithm
Cohen sutherland line clipping algorithmCohen sutherland line clipping algorithm
Cohen sutherland line clipping algorithm
 
Window to viewport transformation
Window to viewport transformationWindow to viewport transformation
Window to viewport transformation
 
Clipping in Computer Graphics
Clipping in Computer Graphics Clipping in Computer Graphics
Clipping in Computer Graphics
 
Hidden surface removal algorithm
Hidden surface removal algorithmHidden surface removal algorithm
Hidden surface removal algorithm
 
Shading
ShadingShading
Shading
 
Clipping
ClippingClipping
Clipping
 
Back face detection
Back face detectionBack face detection
Back face detection
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
Curve and text clipping
Curve and text clippingCurve and text clipping
Curve and text clipping
 
Color Models Computer Graphics
Color Models Computer GraphicsColor Models Computer Graphics
Color Models Computer Graphics
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Polygons - Computer Graphics - Notes
Polygons - Computer Graphics - NotesPolygons - Computer Graphics - Notes
Polygons - Computer Graphics - Notes
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Sr 01-40 good
Sr 01-40 goodSr 01-40 good
Sr 01-40 good
 

Ähnlich wie Sutherlands Cohen and Hodgeman algorithms

Ähnlich wie Sutherlands Cohen and Hodgeman algorithms (20)

CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)CAD - Unit-1 (Fundamentals of Computer Graphics)
CAD - Unit-1 (Fundamentals of Computer Graphics)
 
Lecture 2d point,curve,text,line clipping
Lecture   2d point,curve,text,line clippingLecture   2d point,curve,text,line clipping
Lecture 2d point,curve,text,line clipping
 
Clipping
ClippingClipping
Clipping
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 
Lecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.pptLecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.ppt
 
Clipping
ClippingClipping
Clipping
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
Clipping
ClippingClipping
Clipping
 
Clipping
ClippingClipping
Clipping
 
7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf
 
Clipping
ClippingClipping
Clipping
 
ch4.pptx
ch4.pptxch4.pptx
ch4.pptx
 
line clipping
line clipping line clipping
line clipping
 
Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Implementation
ImplementationImplementation
Implementation
 
Clipping CG ppt.pptx
Clipping CG ppt.pptxClipping CG ppt.pptx
Clipping CG ppt.pptx
 
lecture8 clipping
lecture8 clippinglecture8 clipping
lecture8 clipping
 

Mehr von Rohit Jain

VR - Virtual reality
VR - Virtual realityVR - Virtual reality
VR - Virtual realityRohit Jain
 
Lifi - Light Fidelity
Lifi - Light FidelityLifi - Light Fidelity
Lifi - Light FidelityRohit Jain
 
File system and Deadlocks
File system and DeadlocksFile system and Deadlocks
File system and DeadlocksRohit Jain
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligenceRohit Jain
 
Introduction about Processors
Introduction about Processors Introduction about Processors
Introduction about Processors Rohit Jain
 
Overview On water
Overview On waterOverview On water
Overview On waterRohit Jain
 
Advance peripheral devices
Advance peripheral devicesAdvance peripheral devices
Advance peripheral devicesRohit Jain
 

Mehr von Rohit Jain (9)

VR - Virtual reality
VR - Virtual realityVR - Virtual reality
VR - Virtual reality
 
Social media
Social mediaSocial media
Social media
 
Lifi - Light Fidelity
Lifi - Light FidelityLifi - Light Fidelity
Lifi - Light Fidelity
 
File system and Deadlocks
File system and DeadlocksFile system and Deadlocks
File system and Deadlocks
 
Artificial intelligence
Artificial intelligenceArtificial intelligence
Artificial intelligence
 
Introduction about Processors
Introduction about Processors Introduction about Processors
Introduction about Processors
 
Overview On water
Overview On waterOverview On water
Overview On water
 
Advance peripheral devices
Advance peripheral devicesAdvance peripheral devices
Advance peripheral devices
 
Big Data
Big DataBig Data
Big Data
 

Kürzlich hochgeladen

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performancesivaprakash250
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXssuser89054b
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...tanu pandey
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptMsecMca
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfKamal Acharya
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdfSuman Jyoti
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordAsst.prof M.Gokilavani
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdfKamal Acharya
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...roncy bisnoi
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VDineshKumar4165
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Bookingroncy bisnoi
 

Kürzlich hochgeladen (20)

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
UNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its PerformanceUNIT - IV - Air Compressors and its Performance
UNIT - IV - Air Compressors and its Performance
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Walvekar Nagar Call Me 7737669865 Budget Friendly No Advance Booking
 
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
NFPA 5000 2024 standard .
NFPA 5000 2024 standard                                  .NFPA 5000 2024 standard                                  .
NFPA 5000 2024 standard .
 
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
notes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.pptnotes on Evolution Of Analytic Scalability.ppt
notes on Evolution Of Analytic Scalability.ppt
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete RecordCCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
CCS335 _ Neural Networks and Deep Learning Laboratory_Lab Complete Record
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 

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…