SlideShare a Scribd company logo
1 of 12
S.Rajapriya
Assistant Professor, Dept. of IT
V.V.Vanniaperumal College for Women
Clipping
• Clipping
Clipping is a procedure that identifies those portions
of a picture that are either inside or outside of a specified
region of space.
• Clip Window
A region against which a object is to be clipped.
• It may be a polygon or a curved boundaries. But
rectangular clip window is preferred.
• In clipping, picture parts within window area are
displayed. Everything outside the window area are
discarded.
Types of Clipping
Based on different output primitives :-
Point Clipping
Line Clipping
Polygon Clipping
Curve Clipping
Text Clipping
Exterior Clipping
Line Clipping
Cohen-Sutherland Line Clipping
Liang-Barsky Line Clipping
NLN(Nicholl-Lee-Nicholl) Line Clipping
Line Clipping Using Nonrectangular Clip Windows
Splitting Concave Polygons
Line Clipping Procedure
A line clipping procedure involves several parts:
1.Test a given line segment to determine whether it lies
completely inside the clipping window.
2.Determine whether it lies completely outside the
clipping window
3.If not 1 & 2, perform intersection calculations with one
or more clipping boundaries.
•A line with both endpoints inside all clipping boundaries
is saved.
•A line with both endpoints outside any one of the clipping
boundaries is discarded.
•Other lines cross one or more clipping boundaries &
require calculation of multiple intersection points.
Example
Before Clipping After Clipping
• Line P1P2 is visible because both
endpoints lies inside the boundary.
• Line P5P6 is invisible because both
endpoints are completely outside the
window.
• Line P3P4 &P7P8 are partially visible.
P2
P5
P6
P3
P4
P7
P8
P1
P2
P1
P7
P8
P3
P4
Cohen-Sutherland Line
Clipping
 This is one of the oldest and most popular line clipping
algorithm.
 It reduces the number of intersections that must be
calculated by performing initial tests & speeds up
processing.
 Every line endpoint in a picture is assigned a 4-digit
binary code called region code.
 Region code identifies the location of the point relative to
the boundaries of the clipping rectangle.
Cohen-Sutherland Line
Clipping
Top EdgeLeft Edge
Bottom Edge Right Edge
1st bit (left most) => is set to 1 if end point
is above the top edge of the window
 2nd bit => is set to 1 if end point is below
the bottom edge of the window
 3rd bit => is set to 1 if end point is right of
the right edge of the window
 4th bit => is set to 1 if end point is left of
the left edge of the window
Cohen-Sutherland Example
Consider the line P9 to P10 below
 Start at P10
 From the region codes of the two
end-points we know the line doesn’t
cross the left or right boundary
 Calculate the intersection of the line
with the bottom boundary to generate
point P10’
 The line P9 to P10’ is completely inside the window so is retained
wymax
wymin
wxmin wxmax
Window
P10 [0100]
P9 [0000]
P10’ [0000]
P9 [0000]
Cohen-Sutherland Example
Consider the line P7 to P8 below
 Start at P7
 From the two region codes of the two
end-points we know the line crosses the
left boundary so calculate the intersection
point to generate P7’
Consider the line P7’ to P8
 Start at P8
 Calculate the intersection with the right
boundary to generate P8’
 P7’ to P8’ is inside the window so is retained
wymax
wymin
wxmin wxmax
Window
P7’ [0000]
P7 [0001] P8 [0010]
P8’ [0000]
Calculating Line Intersections
Intersection points with the window boundaries are calculated using the line-
equation parameters
Consider a line with the end-points (x1, y1) and (x2, y2)
 The y-coordinate of an intersection with a vertical window boundary can
be calculated using:
y = y1 + m (xboundary - x1)
where xboundary can be set to either wxmin or wxmax
 The x-coordinate of an intersection with a horizontal window boundary
can be calculated using:
x = x1 + (yboundary - y1) / m
where yboundary can be set to either wymin or wymax
 m is the slope of the line in question and can be calculated as
m = (y2 - y1) / (x2 - x1)
Clipping

More Related Content

What's hot

Comparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementComparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementIJMER
 
Bhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh Panchal
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphicsShaishavShah8
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping2013901097
 
Clipping Algorithm In Computer Graphics
Clipping Algorithm In Computer GraphicsClipping Algorithm In Computer Graphics
Clipping Algorithm In Computer Graphicsstudent(MCA)
 
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
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmMaruf Abdullah (Rion)
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingAnkit Garg
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithmMohamed El-Serngawy
 
Lect7 viewing in2d
Lect7 viewing in2dLect7 viewing in2d
Lect7 viewing in2dBCET
 
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmPolygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmMani Kanth
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clippingmajicyoung
 
Sutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithmSutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithmTawfiq Ahmed
 

What's hot (20)

Comparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for ImprovementComparison of Various Line Clipping Algorithm for Improvement
Comparison of Various Line Clipping Algorithm for Improvement
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
 
line clipping
line clipping line clipping
line clipping
 
Bhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh window clipping slidshare
Bhavesh window clipping slidshare
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping
 
Clipping Algorithm In Computer Graphics
Clipping Algorithm In Computer GraphicsClipping Algorithm In Computer Graphics
Clipping Algorithm In Computer Graphics
 
06 clipping
06 clipping06 clipping
06 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
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Clipping2
Clipping2Clipping2
Clipping2
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
2D viewing
2D viewing2D viewing
2D viewing
 
Circle & curve clipping algorithm
Circle & curve clipping algorithmCircle & curve clipping algorithm
Circle & curve clipping algorithm
 
Lect7 viewing in2d
Lect7 viewing in2dLect7 viewing in2d
Lect7 viewing in2d
 
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithmPolygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
Polygon clipping with sutherland hodgeman algorithm and scan line fill algorithm
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
lecture8 clipping
lecture8 clippinglecture8 clipping
lecture8 clipping
 
Sutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithmSutherland hodgman polygon clipping algorithm
Sutherland hodgman polygon clipping algorithm
 

Similar to Clipping (20)

ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
 
kgv.pptx
kgv.pptxkgv.pptx
kgv.pptx
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
 
Clipping
ClippingClipping
Clipping
 
Chapter4.pdf
Chapter4.pdfChapter4.pdf
Chapter4.pdf
 
UNIT2.pptx
UNIT2.pptxUNIT2.pptx
UNIT2.pptx
 
Clipping
ClippingClipping
Clipping
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygonsLiang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
Liang- Barsky Algorithm, Polygon clipping & pipeline clipping of polygons
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
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)
 
7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 
Clipping
ClippingClipping
Clipping
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
 
ydyu.pptx
ydyu.pptxydyu.pptx
ydyu.pptx
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 

More from Rajapriya82

Applications of IoTs in Home,City,Health
Applications of IoTs in Home,City,HealthApplications of IoTs in Home,City,Health
Applications of IoTs in Home,City,HealthRajapriya82
 
MD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxMD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxRajapriya82
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptxRajapriya82
 
SHA 1 Algorithm.ppt
SHA 1 Algorithm.pptSHA 1 Algorithm.ppt
SHA 1 Algorithm.pptRajapriya82
 
File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptxRajapriya82
 
Consensus Algorithms.pptx
Consensus Algorithms.pptxConsensus Algorithms.pptx
Consensus Algorithms.pptxRajapriya82
 
Security services and mechanisms
Security services and mechanismsSecurity services and mechanisms
Security services and mechanismsRajapriya82
 
Wireless transmission
Wireless transmissionWireless transmission
Wireless transmissionRajapriya82
 
Guided Transmission Media
Guided  Transmission MediaGuided  Transmission Media
Guided Transmission MediaRajapriya82
 
Input of graphical data
Input of graphical dataInput of graphical data
Input of graphical dataRajapriya82
 

More from Rajapriya82 (13)

Applications of IoTs in Home,City,Health
Applications of IoTs in Home,City,HealthApplications of IoTs in Home,City,Health
Applications of IoTs in Home,City,Health
 
MD5 ALGORITHM.pptx
MD5 ALGORITHM.pptxMD5 ALGORITHM.pptx
MD5 ALGORITHM.pptx
 
contiguous memory allocation.pptx
contiguous memory allocation.pptxcontiguous memory allocation.pptx
contiguous memory allocation.pptx
 
SHA 1 Algorithm.ppt
SHA 1 Algorithm.pptSHA 1 Algorithm.ppt
SHA 1 Algorithm.ppt
 
File System Implementation.pptx
File System Implementation.pptxFile System Implementation.pptx
File System Implementation.pptx
 
Consensus Algorithms.pptx
Consensus Algorithms.pptxConsensus Algorithms.pptx
Consensus Algorithms.pptx
 
Security services and mechanisms
Security services and mechanismsSecurity services and mechanisms
Security services and mechanisms
 
Wireless transmission
Wireless transmissionWireless transmission
Wireless transmission
 
Guided Transmission Media
Guided  Transmission MediaGuided  Transmission Media
Guided Transmission Media
 
Input of graphical data
Input of graphical dataInput of graphical data
Input of graphical data
 
Heaptree
HeaptreeHeaptree
Heaptree
 
Deadlock
DeadlockDeadlock
Deadlock
 
Deadlock
DeadlockDeadlock
Deadlock
 

Recently uploaded

EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxiammrhaywood
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxmanuelaromero2013
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting DataJhengPantaleon
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfakmcokerachita
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Educationpboyjonauth
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxthorishapillay1
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13Steve Thomason
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Sapana Sha
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentInMediaRes1
 

Recently uploaded (20)

TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdfTataKelola dan KamSiber Kecerdasan Buatan v022.pdf
TataKelola dan KamSiber Kecerdasan Buatan v022.pdf
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptxSOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
SOCIAL AND HISTORICAL CONTEXT - LFTVD.pptx
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
How to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptxHow to Make a Pirate ship Primary Education.pptx
How to Make a Pirate ship Primary Education.pptx
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data_Math 4-Q4 Week 5.pptx Steps in Collecting Data
_Math 4-Q4 Week 5.pptx Steps in Collecting Data
 
Class 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdfClass 11 Legal Studies Ch-1 Concept of State .pdf
Class 11 Legal Studies Ch-1 Concept of State .pdf
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
call girls in Kamla Market (DELHI) 🔝 >༒9953330565🔝 genuine Escort Service 🔝✔️✔️
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Introduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher EducationIntroduction to ArtificiaI Intelligence in Higher Education
Introduction to ArtificiaI Intelligence in Higher Education
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
Proudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptxProudly South Africa powerpoint Thorisha.pptx
Proudly South Africa powerpoint Thorisha.pptx
 
The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13The Most Excellent Way | 1 Corinthians 13
The Most Excellent Way | 1 Corinthians 13
 
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111Call Girls in Dwarka Mor Delhi Contact Us 9654467111
Call Girls in Dwarka Mor Delhi Contact Us 9654467111
 
Alper Gobel In Media Res Media Component
Alper Gobel In Media Res Media ComponentAlper Gobel In Media Res Media Component
Alper Gobel In Media Res Media Component
 

Clipping

  • 1. S.Rajapriya Assistant Professor, Dept. of IT V.V.Vanniaperumal College for Women
  • 2. Clipping • Clipping Clipping is a procedure that identifies those portions of a picture that are either inside or outside of a specified region of space. • Clip Window A region against which a object is to be clipped. • It may be a polygon or a curved boundaries. But rectangular clip window is preferred. • In clipping, picture parts within window area are displayed. Everything outside the window area are discarded.
  • 3. Types of Clipping Based on different output primitives :- Point Clipping Line Clipping Polygon Clipping Curve Clipping Text Clipping Exterior Clipping
  • 4. Line Clipping Cohen-Sutherland Line Clipping Liang-Barsky Line Clipping NLN(Nicholl-Lee-Nicholl) Line Clipping Line Clipping Using Nonrectangular Clip Windows Splitting Concave Polygons
  • 5. Line Clipping Procedure A line clipping procedure involves several parts: 1.Test a given line segment to determine whether it lies completely inside the clipping window. 2.Determine whether it lies completely outside the clipping window 3.If not 1 & 2, perform intersection calculations with one or more clipping boundaries. •A line with both endpoints inside all clipping boundaries is saved. •A line with both endpoints outside any one of the clipping boundaries is discarded. •Other lines cross one or more clipping boundaries & require calculation of multiple intersection points.
  • 6. Example Before Clipping After Clipping • Line P1P2 is visible because both endpoints lies inside the boundary. • Line P5P6 is invisible because both endpoints are completely outside the window. • Line P3P4 &P7P8 are partially visible. P2 P5 P6 P3 P4 P7 P8 P1 P2 P1 P7 P8 P3 P4
  • 7. Cohen-Sutherland Line Clipping  This is one of the oldest and most popular line clipping algorithm.  It reduces the number of intersections that must be calculated by performing initial tests & speeds up processing.  Every line endpoint in a picture is assigned a 4-digit binary code called region code.  Region code identifies the location of the point relative to the boundaries of the clipping rectangle.
  • 8. Cohen-Sutherland Line Clipping Top EdgeLeft Edge Bottom Edge Right Edge 1st bit (left most) => is set to 1 if end point is above the top edge of the window  2nd bit => is set to 1 if end point is below the bottom edge of the window  3rd bit => is set to 1 if end point is right of the right edge of the window  4th bit => is set to 1 if end point is left of the left edge of the window
  • 9. Cohen-Sutherland Example Consider the line P9 to P10 below  Start at P10  From the region codes of the two end-points we know the line doesn’t cross the left or right boundary  Calculate the intersection of the line with the bottom boundary to generate point P10’  The line P9 to P10’ is completely inside the window so is retained wymax wymin wxmin wxmax Window P10 [0100] P9 [0000] P10’ [0000] P9 [0000]
  • 10. Cohen-Sutherland Example Consider the line P7 to P8 below  Start at P7  From the two region codes of the two end-points we know the line crosses the left boundary so calculate the intersection point to generate P7’ Consider the line P7’ to P8  Start at P8  Calculate the intersection with the right boundary to generate P8’  P7’ to P8’ is inside the window so is retained wymax wymin wxmin wxmax Window P7’ [0000] P7 [0001] P8 [0010] P8’ [0000]
  • 11. Calculating Line Intersections Intersection points with the window boundaries are calculated using the line- equation parameters Consider a line with the end-points (x1, y1) and (x2, y2)  The y-coordinate of an intersection with a vertical window boundary can be calculated using: y = y1 + m (xboundary - x1) where xboundary can be set to either wxmin or wxmax  The x-coordinate of an intersection with a horizontal window boundary can be calculated using: x = x1 + (yboundary - y1) / m where yboundary can be set to either wymin or wymax  m is the slope of the line in question and can be calculated as m = (y2 - y1) / (x2 - x1)