SlideShare a Scribd company logo
1 of 16
 Clipping means identifying portions of a scene that are
outside a specified region.
 For a 2D graphics the region defining what is to be
clipped is called the clip window.
 Types of clipping:
1. All-or-none clipping: If any part of object outside clip
window then the whole object is rejected.
2. Point clipping: Only keep the points that are inside clip
window.
3. Line clipping: Only keep segment of line inside clip
window.
4. Polygon clipping: Only keep segment of polygon inside
clip window.
5. Text clipping.
 Suppose that the clip window is a rectangle. The point
P = (x, y) is saved for display if the following are
satisfied:
xwmin ≤ x ≤ xwmax
ywmin ≤ y ≤ ywmax
 Otherwise, the point will be clipped (not saved for
display).
 P1= (10,20), P2= (30,50), P3= (60,90), and P4=
(130,150). Suppose that the coordinates of the two
opposite corners of the clip window are (xwmin, ywmin) =
(30, 30) and (xwmax, ywmax) = (130, 110). Which of the
above points will be clipped?
 P2 and P3 will saved because:
 For P2: 30 ≤ 30 ≤ 130 and 30 ≤ 50 ≤ 110.
 For P3: 30 ≤ 60 ≤ 130 and 30 ≤ 90 ≤ 110.
 For a line segment with endpoints (x1, y1) & (x2, y2)
and one or both endpoints outside the clipping
window, the parametric representation:
x= x1 + u(x2 – x1) and y= y1 + u(y2 – y1), where 0 ≤ u ≤ 1
 Line endpoints P1= (56,10) & P2= (62,16). Suppose that
the coordinates of the two opposite corners of the clip
window are (xwmin,ywmin)= (60,10) & (xwmax,ywmax)=
(70,16). Check the for clipping.
 x= 60= 56 + u(62 – 56), u= 4/6. So we deduce the line (56,10)-
(62,16) cross the left boundary (x = 60) of the clip window.
 x= 70= 56 + u(62 – 56), u= 14/6. So we deduce the line
(56,10)-(62,16) is not crossing the right boundary (x = 70) of
the clip window.
 y= 16= 10 + u(16 – 10), u= 6/6. So we deduce the line (56,10)-
(62,16) cross the top boundary (y = 16) of the clip window.
 y= 10= 10 + u(16 – 10), u= 0/6. So we deduce the line (56,10)-
(62,16) cross the bottom boundary (y = 10) of the clip
window.
 Step 1 − Assign a region code for each endpoints.
 Step 2 − If both endpoints have a region code 0000 then
accept this line.
 Step 3 − Else, perform the logical AND operation for both
region codes.
 Step 3.1 − If the result is not 0000, then reject the line.
 Step 3.2 − Else you need clipping.
 Step 3.2.1 − Choose an endpoint of the line that is outside
the window.
 Step 3.2.2 − Find the intersection point at the window
boundary.
 Step 3.2.3 − Replace endpoint with the intersection point
and update the region code.
 Step 3.2.4 − Repeat step 2 until we find a clipped line
either trivially accepted or trivially rejected.
 Step 4 − Repeat step 1 for other lines.
 Compute the end point Outcodes of A and B;
 if (A == 0000 && B == 0000)
 the whole line is visible (accept it);
 Else if (A AND B != 0000)
 the whole line is outside of window (reject it);
 else repeat the following {
 compute intersection;
 clip outside part;
 test again;}
 Assign a binary 4 bit code to each vertex by comparing
it to clip coordinates:
 Bit 1 (left): the sign bit of x – xwmin.
 Bit 2 (right): the sign bit of xwmax – x.
 Bit 3 (below): the sign bit of y – ywmin.
 Bit 4 (above): the sign bit of ywmax – y.
 Suppose that the coordinates of opposite corners of the
clip window are (68,59) & (92,71). Use Cohen-
Sutherland clipping line algorithm to find region codes
of the line (72,65)-(90,68), and the line (74,93)-(85,100),
and the line (60,50)-(120, 93).
 Solution:
1. Calculate differences between endpoint coordinates
and clipping boundaries.
2. Use the resultant sign bit of each difference
calculation to set the corresponding value in the
region code.
 Line (72,65)-(90,68):
 the region code of (72,65) is 0000
 the region code of (90,68) is 0000
 The line (72-65)-(90,68) is
completely inside
 Line (74,93)-(85,100):
 the region code of (74,93) is 1000
 the region code of (85,100) is 1000
 Since 1000 AND 1000 = 1000 (Non Zero), so the line
(74,93) – (85,100) lie completely outside the clipping
region. So we clip it.
 Line (60,50)-(120,95):
 the region code of (60,50) is 1010
 the region code of (120,95) is 0101
 The line is saved because the final region code is 0000.
 Suppose that the coordinates of opposite corners of the
clip window are (4,2) & (12,8). Use Cohen-Sutherland
clipping line algorithm to check the two endpoints (6,10)
and (13,15).
 the region code of (6,10) is 0001
 the region code of (120,95) is 0101
 With AND operation the region code is 0001 (Clipped).

More Related Content

What's hot

Composite transformations
Composite transformationsComposite transformations
Composite transformationsMohd Arif
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer GraphicsLaxman Puri
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmMaruf Abdullah (Rion)
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4PrathimaBaliga
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan systemshalinikarunakaran1
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clippingMdAlAmin187
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmRuchi Maurya
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Mani Kanth
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphicsShaishavShah8
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive SachiniGunawardana
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 

What's hot (20)

Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Composite transformations
Composite transformationsComposite transformations
Composite transformations
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Raster scan system & random scan system
Raster scan system & random scan systemRaster scan system & random scan system
Raster scan system & random scan system
 
3 d display methods
3 d display methods3 d display methods
3 d display methods
 
Z buffer
Z bufferZ buffer
Z buffer
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
Video display devices
Video display devicesVideo display devices
Video display devices
 
Computer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithmComputer graphics - bresenham line drawing algorithm
Computer graphics - bresenham line drawing algorithm
 
Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...Window to viewport transformation&matrix representation of homogeneous co...
Window to viewport transformation&matrix representation of homogeneous co...
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
03.Scan Conversion.ppt
03.Scan Conversion.ppt03.Scan Conversion.ppt
03.Scan Conversion.ppt
 

Similar to Computer Graphics - clipping

19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdfKrishnaKumar2309
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmShilpa Hait
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptxRYZEN14
 
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
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clippingShweta Shah
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfAmol Gaikwad
 
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 clippingavelraj
 
Unit 3
Unit 3Unit 3
Unit 3ypnrao
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manualAnkit Kumar
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1aravindangc
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygonsaa11bb11
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons dericationKumar
 
10CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 510CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 5Vanishree Arun
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfRajJain516913
 

Similar to Computer Graphics - clipping (20)

19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
19BCS2605_Krishna_Kumar_Computer_Graphics_exp_3.1.pdf
 
Cohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithmCohen-sutherland & liang-basky line clipping algorithm
Cohen-sutherland & liang-basky line clipping algorithm
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
 
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
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
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
 
Line clipping
Line clippingLine clipping
Line clipping
 
line clipping
line clipping line clipping
line clipping
 
Unit 3
Unit 3Unit 3
Unit 3
 
Computer graphics lab manual
Computer graphics lab manualComputer graphics lab manual
Computer graphics lab manual
 
Computer Graphics Unit 1
Computer Graphics Unit 1Computer Graphics Unit 1
Computer Graphics Unit 1
 
Bresenham circlesandpolygons
Bresenham circlesandpolygonsBresenham circlesandpolygons
Bresenham circlesandpolygons
 
Bresenham circles and polygons derication
Bresenham circles and polygons dericationBresenham circles and polygons derication
Bresenham circles and polygons derication
 
10CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 510CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 5
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
Clipping
ClippingClipping
Clipping
 
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdfCD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
CD504 CGM_Lab Manual_004e08d3838702ed11fc6d03cc82f7be.pdf
 

More from Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D

More from Hisham Al Kurdi, EAVA, DMC-D-4K, HCCA-P, HCAA-D (20)

Audio
AudioAudio
Audio
 
The Passive
The PassiveThe Passive
The Passive
 
Relative Clauses
Relative ClausesRelative Clauses
Relative Clauses
 
Quantifiers
QuantifiersQuantifiers
Quantifiers
 
Present Simple and Continuous
Present Simple and ContinuousPresent Simple and Continuous
Present Simple and Continuous
 
Present Perfect Simple and Continuous
Present Perfect Simple and ContinuousPresent Perfect Simple and Continuous
Present Perfect Simple and Continuous
 
Prepositions
PrepositionsPrepositions
Prepositions
 
Past Simple and Continuous
Past Simple and ContinuousPast Simple and Continuous
Past Simple and Continuous
 
Obligation and Permission
Obligation and PermissionObligation and Permission
Obligation and Permission
 
Comparatives and Superlatives
Comparatives and SuperlativesComparatives and Superlatives
Comparatives and Superlatives
 
Auxiliary verbs
Auxiliary verbsAuxiliary verbs
Auxiliary verbs
 
Adjective ending in ed or ing
Adjective ending in ed or ingAdjective ending in ed or ing
Adjective ending in ed or ing
 
Operations Research - Game Theory
Operations Research - Game TheoryOperations Research - Game Theory
Operations Research - Game Theory
 
Operations Research - Sensitivity Analysis
Operations Research - Sensitivity AnalysisOperations Research - Sensitivity Analysis
Operations Research - Sensitivity Analysis
 
Operations Research - The Dual Simplex Method
Operations Research - The Dual Simplex MethodOperations Research - The Dual Simplex Method
Operations Research - The Dual Simplex Method
 
Operations Research - The Revised Simplex Method
Operations Research - The Revised Simplex MethodOperations Research - The Revised Simplex Method
Operations Research - The Revised Simplex Method
 
Operations Research - The Two Phase Method
Operations Research - The Two Phase MethodOperations Research - The Two Phase Method
Operations Research - The Two Phase Method
 
Operations Research - The Big M Method
Operations Research - The Big M MethodOperations Research - The Big M Method
Operations Research - The Big M Method
 
Operations Research - Simplex Method Tableau
Operations Research - Simplex Method TableauOperations Research - Simplex Method Tableau
Operations Research - Simplex Method Tableau
 
Operations Research - Simplex Method Principles
Operations Research - Simplex Method PrinciplesOperations Research - Simplex Method Principles
Operations Research - Simplex Method Principles
 

Recently uploaded

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...M56BOOKSTORE PRODUCT/SERVICE
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
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
 
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
 
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
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
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
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxGaneshChakor2
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxEyham Joco
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...jaredbarbolino94
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Celine George
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 

Recently uploaded (20)

KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
KSHARA STURA .pptx---KSHARA KARMA THERAPY (CAUSTIC THERAPY)————IMP.OF KSHARA ...
 
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
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
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
 
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 🔝✔️✔️
 
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
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
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
 
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🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
CARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptxCARE OF CHILD IN INCUBATOR..........pptx
CARE OF CHILD IN INCUBATOR..........pptx
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 
Types of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptxTypes of Journalistic Writing Grade 8.pptx
Types of Journalistic Writing Grade 8.pptx
 
Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...Historical philosophical, theoretical, and legal foundations of special and i...
Historical philosophical, theoretical, and legal foundations of special and i...
 
Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17Computed Fields and api Depends in the Odoo 17
Computed Fields and api Depends in the Odoo 17
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 

Computer Graphics - clipping

  • 1.
  • 2.  Clipping means identifying portions of a scene that are outside a specified region.  For a 2D graphics the region defining what is to be clipped is called the clip window.  Types of clipping: 1. All-or-none clipping: If any part of object outside clip window then the whole object is rejected. 2. Point clipping: Only keep the points that are inside clip window. 3. Line clipping: Only keep segment of line inside clip window. 4. Polygon clipping: Only keep segment of polygon inside clip window. 5. Text clipping.
  • 3.
  • 4.  Suppose that the clip window is a rectangle. The point P = (x, y) is saved for display if the following are satisfied: xwmin ≤ x ≤ xwmax ywmin ≤ y ≤ ywmax  Otherwise, the point will be clipped (not saved for display).
  • 5.  P1= (10,20), P2= (30,50), P3= (60,90), and P4= (130,150). Suppose that the coordinates of the two opposite corners of the clip window are (xwmin, ywmin) = (30, 30) and (xwmax, ywmax) = (130, 110). Which of the above points will be clipped?  P2 and P3 will saved because:  For P2: 30 ≤ 30 ≤ 130 and 30 ≤ 50 ≤ 110.  For P3: 30 ≤ 60 ≤ 130 and 30 ≤ 90 ≤ 110.
  • 6.
  • 7.  For a line segment with endpoints (x1, y1) & (x2, y2) and one or both endpoints outside the clipping window, the parametric representation: x= x1 + u(x2 – x1) and y= y1 + u(y2 – y1), where 0 ≤ u ≤ 1
  • 8.  Line endpoints P1= (56,10) & P2= (62,16). Suppose that the coordinates of the two opposite corners of the clip window are (xwmin,ywmin)= (60,10) & (xwmax,ywmax)= (70,16). Check the for clipping.  x= 60= 56 + u(62 – 56), u= 4/6. So we deduce the line (56,10)- (62,16) cross the left boundary (x = 60) of the clip window.  x= 70= 56 + u(62 – 56), u= 14/6. So we deduce the line (56,10)-(62,16) is not crossing the right boundary (x = 70) of the clip window.  y= 16= 10 + u(16 – 10), u= 6/6. So we deduce the line (56,10)- (62,16) cross the top boundary (y = 16) of the clip window.  y= 10= 10 + u(16 – 10), u= 0/6. So we deduce the line (56,10)- (62,16) cross the bottom boundary (y = 10) of the clip window.
  • 9.  Step 1 − Assign a region code for each endpoints.  Step 2 − If both endpoints have a region code 0000 then accept this line.  Step 3 − Else, perform the logical AND operation for both region codes.  Step 3.1 − If the result is not 0000, then reject the line.  Step 3.2 − Else you need clipping.  Step 3.2.1 − Choose an endpoint of the line that is outside the window.  Step 3.2.2 − Find the intersection point at the window boundary.  Step 3.2.3 − Replace endpoint with the intersection point and update the region code.  Step 3.2.4 − Repeat step 2 until we find a clipped line either trivially accepted or trivially rejected.  Step 4 − Repeat step 1 for other lines.
  • 10.  Compute the end point Outcodes of A and B;  if (A == 0000 && B == 0000)  the whole line is visible (accept it);  Else if (A AND B != 0000)  the whole line is outside of window (reject it);  else repeat the following {  compute intersection;  clip outside part;  test again;}
  • 11.  Assign a binary 4 bit code to each vertex by comparing it to clip coordinates:  Bit 1 (left): the sign bit of x – xwmin.  Bit 2 (right): the sign bit of xwmax – x.  Bit 3 (below): the sign bit of y – ywmin.  Bit 4 (above): the sign bit of ywmax – y.
  • 12.  Suppose that the coordinates of opposite corners of the clip window are (68,59) & (92,71). Use Cohen- Sutherland clipping line algorithm to find region codes of the line (72,65)-(90,68), and the line (74,93)-(85,100), and the line (60,50)-(120, 93).  Solution: 1. Calculate differences between endpoint coordinates and clipping boundaries. 2. Use the resultant sign bit of each difference calculation to set the corresponding value in the region code.
  • 13.  Line (72,65)-(90,68):  the region code of (72,65) is 0000  the region code of (90,68) is 0000  The line (72-65)-(90,68) is completely inside
  • 14.  Line (74,93)-(85,100):  the region code of (74,93) is 1000  the region code of (85,100) is 1000  Since 1000 AND 1000 = 1000 (Non Zero), so the line (74,93) – (85,100) lie completely outside the clipping region. So we clip it.
  • 15.  Line (60,50)-(120,95):  the region code of (60,50) is 1010  the region code of (120,95) is 0101  The line is saved because the final region code is 0000.
  • 16.  Suppose that the coordinates of opposite corners of the clip window are (4,2) & (12,8). Use Cohen-Sutherland clipping line algorithm to check the two endpoints (6,10) and (13,15).  the region code of (6,10) is 0001  the region code of (120,95) is 0101  With AND operation the region code is 0001 (Clipped).