SlideShare a Scribd company logo
1 of 35
CLIPPING
NEHRUREVATHY
DEPT OF BCA
Clipping
• Definition:Any procedure that identifies those
portions of a picture that are either inside or
outside of a specified region or space is known as
clipping.
• For deciding the visible and invisible portion, a
particular process called clipping is used.
• Clipping determines each element into the visible
and invisible portion.
• Visible portion is selected.
• An invisible portion is discarded.
Types of Lines:Three types
• Visible: A line or lines entirely inside the
window is considered visible
• Invisible: A line entirely outside the window is
considered invisible
• Clipped: A line partially inside the window and
partially outside is clipped.
For clipping point of intersection of a line with
the window is determined.
Clipping
Types of Clipping:
• Point Clipping
• Line Clipping
• Area Clipping (Polygon)
• Curve Clipping
• Text Clipping
• Exterior Clipping
Line Clipping
• It is performed by using the line clipping
algorithm.
• The line clipping algorithms are:
Cohen Sutherland Line Clipping Algorithm
Midpoint Subdivision Line Clipping Algorithm
Liang-Barsky Line Clipping Algorithm
Cohen Sutherland Line Clipping
Algorithm:
• In the algorithm, first of all, it is detected
whether line lies inside the screen or it is
outside the screen.
• All lines come under any one of the following
categories:
Visible
Not Visible
Clipping Case
Cohen Sutherland Line Clipping
Algorithm:
1. Visible:
 If a line lies within the window, i.e., both
endpoints of the line lies within the window.
 A line is visible and will be displayed as it is.
2. Not Visible:
 If a line lies outside the window it will be
invisible and rejected. Such lines will not display.
Let A (x1,y2) and B (x2,y2) are endpoints of line.
 xmin,xmax are coordinates of the window.
ymin,ymax are also coordinates of the window.
If any one of the following inequalities is
satisfied, then the line is considered invisible.
x1>xmax
x2>xmax
y1>ymax
y2>ymax
x1<xmin
x2<xmin
y1<ymin
y2<ymin
Cohen Sutherland Line Clipping
Algorithm
3. Clipping Case:
If the line is neither visible case nor invisible case.
It is considered to be clipped case.
First of all, the category of a line is found based
on nine regions given below.
All nine regions are assigned codes.
 Each code is of 4 bits.
If both endpoints of the line have end bits zero,
then the line is considered to be visible.
The center area is having the code, 0000,
i.e., region 5 is considered a rectangle window.
Following figure show
lines of various types
Line AB is the visible case
Line OP is an invisible
case
Line PQ is an invisible
line
Line IJ are clipping
candidates
Line MN are clipping
candidate
Line CD are clipping
candidate
Advantage of Cohen Sutherland Line
Clipping:
• It calculates end-points very quickly and
rejects and accepts lines quickly.
• It can clip pictures much large than screen
size.
Algorithm of Cohen Sutherland Line
Clipping:
• Step1:Calculate positions of both endpoints of
the line
• Step2:Perform OR operation on both of these
end-points
• Step3:If the OR operation gives 0000
Then
line is considered to be visible
else
Perform AND operation on both endpoints
Algorithm:
If And ≠ 0000
then the line is invisible
else
And=0000
Line is considered the clipped case.
• Step4:If a line is clipped case, find an
intersection with boundaries of the window
m=(y2-y1 )(x2-x1)
Algorithm
• (a) If bit 1 is "1" line intersects with left boundary
of rectangle window
y3=y1+m(x-X1)
where X = Xwmin
where Xwminis the minimum value of X
co-ordinate of window
• (b) If bit 2 is "1" line intersect with right boundary
y3=y1+m(X-X1)
where X = Xwmax
where X more is maximum value of X co-
ordinate of the window
Algorithm
• (c) If bit 3 is "1" line intersects with bottom boundary
X3=X1+(y-y1)/m
where y = ywmin
ywmin is the minimum value of Y co-ordinate of
the window
• (d) If bit 4 is "1" line intersects with the top boundary
X3=X1+(y-y1)/m
where y = ywmax
ywmax is the maximum value of Y co-ordinate
of the window
Text Clipping
• A simple method is completely considered, or
nothing considers method.
• This method is also called as all or none.
• If all characters of the string are inside
window, then we will keep the string.
• If a string character is outside then whole
string will be discarded in fig (a).
Text Clipping
• Another method is discarded those characters
not completely inside the window.
• If a character overlap boundary of window.
Those will be discarded in fig (b).
• In fig (c) individual character is treated.
Character lies on boundary is discarded as
which it is outside the window.
Text Clipping-Example:
Polygon Clipping
• Polygon clipping is applied to the polygons.
• The term polygon is used to define objects
having outline of solid.
• These objects should maintain property and
shape of polygon after clipping.
Sutherland-Hodgeman Polygon
Clipping:
• It is performed by processing the boundary of
polygon against each window corner or edge.
• First of all entire polygon is clipped against
one edge, then resulting polygon is
considered, then the polygon is considered
against the second edge, so on for all four
edges.
Four possible situations while
processing
• If the first vertex is an outside the window, the second
vertex is inside the window. Then second vertex is
added to the output list. The point of intersection of
window boundary and polygon side (edge) is also
added to the output line.
• If both vertexes are inside window boundary. Then only
second vertex is added to the output list.
• If the first vertex is inside the window and second is an
outside window. The edge which intersects with
window is added to output list.
• If both vertices are the outside window, then nothing is
added to output list.
Example:
WINDOW-TO-VIEWPORT
COORDINATE TRANSFORMATION
• A world-coordinate area selected for display is
called a window.
• An area on a display device to which a
window is mapped is called a viewport.
• The window defines what is to be viewed; the
viewport defines where it is to be displayed.
Viewing transformation or window to viewport
transformation or windowing transformation:The
mapping of a part of a world-coordinate scene to
device coordinates is referred to as a viewing
transformation.
Viewing transformation in several
steps:
• First, we construct the scene in world coordinate
using the output primitives and attributes.
• To obtain a particular orientation, we can set up a
2-D viewing coordinate system in the window
coordinate plane and define a window in viewing
coordinates system.
• Once the viewing frame is established, are then
transform description in world coordinates to
viewing coordinates.
Viewing transformation in several
steps:
• Then, we define viewport in normalized
coordinates (range from 0 to 1) and map the
viewing coordinates description of the scene
to normalized coordinates.
• At the final step, all parts of the picture that
(i.e., outside the viewport are dipped, and the
contents are transferred to device
coordinates).
2D Viewing Transformation
WINDOW-TO-VIEWPORT
COORDINATE TRANSFORMATION
In order to maintain the same relative
placement of the point in the viewport
as in the window, we require:
viewport position (xv, yv), we have:
xv=xvmin+(xw-xwmin)sx
yv=yvmin+(yw-ywmin)sy ...........equation 2
Where scaling factors are
Equation (1) and Equation (2) can also
be derived with a set of
transformation that converts the
window or world coordinate area into
the viewport or screen coordinate
area.
This conversation is performed with the following
sequence of transformations:
Perform a scaling transformation using a fixed
point position (xwmin,ywmin) that scales the
window area to the size of the viewport.
Translate the scaled window area to the
position of the viewport. Relative proportions
of objects are maintained if the scaling factors
are the same (sx=sy).
THANK U

More Related Content

What's hot

Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 
Overview of Graphics System
Overview of Graphics SystemOverview of Graphics System
Overview of Graphics SystemPrathimaBaliga
 
Introduction to computer graphics
Introduction to computer graphics Introduction to computer graphics
Introduction to computer graphics Priyodarshini Dhar
 
Animation in Computer Graphics
Animation in Computer GraphicsAnimation in Computer Graphics
Animation in Computer GraphicsRinkuNahar
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)shalinikarunakaran1
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingAnkit Garg
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothningVinay Gupta
 
Ppt on flat panel display
Ppt on flat panel displayPpt on flat panel display
Ppt on flat panel displayAlisha Korpal
 
Raster Scan and Raster Scan Displays
Raster Scan and Raster Scan DisplaysRaster Scan and Raster Scan Displays
Raster Scan and Raster Scan DisplaysSaravana Priya
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)Timbal Mayank
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversionMohd Arif
 
Raster scan displays ppt
Raster scan displays pptRaster scan displays ppt
Raster scan displays pptABHISHEK KUMAR
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projectionPooja Dixit
 
Scan line method
Scan line methodScan line method
Scan line methodPooja Dixit
 

What's hot (20)

Computer graphics
Computer graphicsComputer graphics
Computer graphics
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Overview of Graphics System
Overview of Graphics SystemOverview of Graphics System
Overview of Graphics System
 
Introduction to computer graphics
Introduction to computer graphics Introduction to computer graphics
Introduction to computer graphics
 
Animation in Computer Graphics
Animation in Computer GraphicsAnimation in Computer Graphics
Animation in Computer Graphics
 
Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)Attributes of output primitive(line attributes)
Attributes of output primitive(line attributes)
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Digital image processing img smoothning
Digital image processing img smoothningDigital image processing img smoothning
Digital image processing img smoothning
 
Z buffer
Z bufferZ buffer
Z buffer
 
Clipping
ClippingClipping
Clipping
 
Ppt on flat panel display
Ppt on flat panel displayPpt on flat panel display
Ppt on flat panel display
 
Raster Scan and Raster Scan Displays
Raster Scan and Raster Scan DisplaysRaster Scan and Raster Scan Displays
Raster Scan and Raster Scan Displays
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Intro to scan conversion
Intro to scan conversionIntro to scan conversion
Intro to scan conversion
 
Raster scan displays ppt
Raster scan displays pptRaster scan displays ppt
Raster scan displays ppt
 
3 d viewing projection
3 d viewing  projection3 d viewing  projection
3 d viewing projection
 
Scan line method
Scan line methodScan line method
Scan line method
 

Similar to Clipping

Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphicsShaishavShah8
 
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
 
Clipping & Rasterization
Clipping & RasterizationClipping & Rasterization
Clipping & RasterizationAhmed Daoud
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clippingmajicyoung
 
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
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clippingMdAlAmin187
 
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 polygonsLahiru Danushka
 
Lecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.pptLecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.pptGaganvirKaur
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptxRYZEN14
 

Similar to Clipping (20)

Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Clipping
ClippingClipping
Clipping
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
Clipping & Rasterization
Clipping & RasterizationClipping & Rasterization
Clipping & Rasterization
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
line clipping
line clipping line clipping
line clipping
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
 
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
 
7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf7-Clipping-16 (1).pdf
7-Clipping-16 (1).pdf
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
yutd65.pptx
yutd65.pptxyutd65.pptx
yutd65.pptx
 
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
 
ch4.pptx
ch4.pptxch4.pptx
ch4.pptx
 
Clipping
ClippingClipping
Clipping
 
ohu.pptx
ohu.pptxohu.pptx
ohu.pptx
 
Lecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.pptLecture1616_16827_2D Clipping.ppt
Lecture1616_16827_2D Clipping.ppt
 
Implementation
ImplementationImplementation
Implementation
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
 

More from nehrurevathy

Revision 3 updated
Revision 3 updatedRevision 3 updated
Revision 3 updatednehrurevathy
 
CATHODE RAY TUBE IN COMPUTER GRAPHICS
CATHODE RAY TUBE IN COMPUTER GRAPHICSCATHODE RAY TUBE IN COMPUTER GRAPHICS
CATHODE RAY TUBE IN COMPUTER GRAPHICSnehrurevathy
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithmnehrurevathy
 
Lline Drawing Algorithm
Lline Drawing AlgorithmLline Drawing Algorithm
Lline Drawing Algorithmnehrurevathy
 
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICSATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICSnehrurevathy
 
2D- Transformation
2D- Transformation2D- Transformation
2D- Transformationnehrurevathy
 
COLOR CRT MONITORS IN COMPUTER GRAPHICS
COLOR CRT MONITORS IN COMPUTER GRAPHICSCOLOR CRT MONITORS IN COMPUTER GRAPHICS
COLOR CRT MONITORS IN COMPUTER GRAPHICSnehrurevathy
 

More from nehrurevathy (7)

Revision 3 updated
Revision 3 updatedRevision 3 updated
Revision 3 updated
 
CATHODE RAY TUBE IN COMPUTER GRAPHICS
CATHODE RAY TUBE IN COMPUTER GRAPHICSCATHODE RAY TUBE IN COMPUTER GRAPHICS
CATHODE RAY TUBE IN COMPUTER GRAPHICS
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Lline Drawing Algorithm
Lline Drawing AlgorithmLline Drawing Algorithm
Lline Drawing Algorithm
 
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICSATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
ATTRIBUTES OF OUTPUT PRIMITIVES IN COMPUTER GRAPHICS
 
2D- Transformation
2D- Transformation2D- Transformation
2D- Transformation
 
COLOR CRT MONITORS IN COMPUTER GRAPHICS
COLOR CRT MONITORS IN COMPUTER GRAPHICSCOLOR CRT MONITORS IN COMPUTER GRAPHICS
COLOR CRT MONITORS IN COMPUTER GRAPHICS
 

Recently uploaded

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxmarlenawright1
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsNbelano25
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...Nguyen Thanh Tu Collection
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonhttgc7rh9c
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfNirmal Dwivedi
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111GangaMaiya1
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxakanksha16arora
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17Celine George
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesSHIVANANDaRV
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of PlayPooky Knightsmith
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsSandeep D Chaudhary
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...Amil baba
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - Englishneillewis46
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxPooja Bhuva
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxannathomasp01
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxDr. Ravikiran H M Gowda
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17Celine George
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxPooja Bhuva
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfDr Vijay Vishwakarma
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxCeline George
 

Recently uploaded (20)

HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptxHMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
HMCS Vancouver Pre-Deployment Brief - May 2024 (Web Version).pptx
 
Tatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf artsTatlong Kwento ni Lola basyang-1.pdf arts
Tatlong Kwento ni Lola basyang-1.pdf arts
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lessonQUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
QUATER-1-PE-HEALTH-LC2- this is just a sample of unpacked lesson
 
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdfUGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
UGC NET Paper 1 Unit 7 DATA INTERPRETATION.pdf
 
Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111Details on CBSE Compartment Exam.pptx1111
Details on CBSE Compartment Exam.pptx1111
 
PANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptxPANDITA RAMABAI- Indian political thought GENDER.pptx
PANDITA RAMABAI- Indian political thought GENDER.pptx
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
Economic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food AdditivesEconomic Importance Of Fungi In Food Additives
Economic Importance Of Fungi In Food Additives
 
Play hard learn harder: The Serious Business of Play
Play hard learn harder:  The Serious Business of PlayPlay hard learn harder:  The Serious Business of Play
Play hard learn harder: The Serious Business of Play
 
OSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & SystemsOSCM Unit 2_Operations Processes & Systems
OSCM Unit 2_Operations Processes & Systems
 
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
NO1 Top Black Magic Specialist In Lahore Black magic In Pakistan Kala Ilam Ex...
 
Graduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - EnglishGraduate Outcomes Presentation Slides - English
Graduate Outcomes Presentation Slides - English
 
Interdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptxInterdisciplinary_Insights_Data_Collection_Methods.pptx
Interdisciplinary_Insights_Data_Collection_Methods.pptx
 
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptxCOMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
COMMUNICATING NEGATIVE NEWS - APPROACHES .pptx
 
REMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptxREMIFENTANIL: An Ultra short acting opioid.pptx
REMIFENTANIL: An Ultra short acting opioid.pptx
 
How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17How to Add a Tool Tip to a Field in Odoo 17
How to Add a Tool Tip to a Field in Odoo 17
 
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptxOn_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
On_Translating_a_Tamil_Poem_by_A_K_Ramanujan.pptx
 
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdfUnit 3 Emotional Intelligence and Spiritual Intelligence.pdf
Unit 3 Emotional Intelligence and Spiritual Intelligence.pdf
 
What is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptxWhat is 3 Way Matching Process in Odoo 17.pptx
What is 3 Way Matching Process in Odoo 17.pptx
 

Clipping

  • 2. Clipping • Definition:Any procedure that identifies those portions of a picture that are either inside or outside of a specified region or space is known as clipping. • For deciding the visible and invisible portion, a particular process called clipping is used. • Clipping determines each element into the visible and invisible portion. • Visible portion is selected. • An invisible portion is discarded.
  • 3. Types of Lines:Three types • Visible: A line or lines entirely inside the window is considered visible • Invisible: A line entirely outside the window is considered invisible • Clipped: A line partially inside the window and partially outside is clipped. For clipping point of intersection of a line with the window is determined.
  • 5. Types of Clipping: • Point Clipping • Line Clipping • Area Clipping (Polygon) • Curve Clipping • Text Clipping • Exterior Clipping
  • 6. Line Clipping • It is performed by using the line clipping algorithm. • The line clipping algorithms are: Cohen Sutherland Line Clipping Algorithm Midpoint Subdivision Line Clipping Algorithm Liang-Barsky Line Clipping Algorithm
  • 7. Cohen Sutherland Line Clipping Algorithm: • In the algorithm, first of all, it is detected whether line lies inside the screen or it is outside the screen. • All lines come under any one of the following categories: Visible Not Visible Clipping Case
  • 8. Cohen Sutherland Line Clipping Algorithm: 1. Visible:  If a line lies within the window, i.e., both endpoints of the line lies within the window.  A line is visible and will be displayed as it is. 2. Not Visible:  If a line lies outside the window it will be invisible and rejected. Such lines will not display. Let A (x1,y2) and B (x2,y2) are endpoints of line.  xmin,xmax are coordinates of the window. ymin,ymax are also coordinates of the window.
  • 9. If any one of the following inequalities is satisfied, then the line is considered invisible. x1>xmax x2>xmax y1>ymax y2>ymax x1<xmin x2<xmin y1<ymin y2<ymin
  • 10. Cohen Sutherland Line Clipping Algorithm 3. Clipping Case: If the line is neither visible case nor invisible case. It is considered to be clipped case. First of all, the category of a line is found based on nine regions given below. All nine regions are assigned codes.  Each code is of 4 bits. If both endpoints of the line have end bits zero, then the line is considered to be visible.
  • 11. The center area is having the code, 0000, i.e., region 5 is considered a rectangle window.
  • 12. Following figure show lines of various types Line AB is the visible case Line OP is an invisible case Line PQ is an invisible line Line IJ are clipping candidates Line MN are clipping candidate Line CD are clipping candidate
  • 13. Advantage of Cohen Sutherland Line Clipping: • It calculates end-points very quickly and rejects and accepts lines quickly. • It can clip pictures much large than screen size.
  • 14. Algorithm of Cohen Sutherland Line Clipping: • Step1:Calculate positions of both endpoints of the line • Step2:Perform OR operation on both of these end-points • Step3:If the OR operation gives 0000 Then line is considered to be visible else Perform AND operation on both endpoints
  • 15. Algorithm: If And ≠ 0000 then the line is invisible else And=0000 Line is considered the clipped case. • Step4:If a line is clipped case, find an intersection with boundaries of the window m=(y2-y1 )(x2-x1)
  • 16. Algorithm • (a) If bit 1 is "1" line intersects with left boundary of rectangle window y3=y1+m(x-X1) where X = Xwmin where Xwminis the minimum value of X co-ordinate of window • (b) If bit 2 is "1" line intersect with right boundary y3=y1+m(X-X1) where X = Xwmax where X more is maximum value of X co- ordinate of the window
  • 17. Algorithm • (c) If bit 3 is "1" line intersects with bottom boundary X3=X1+(y-y1)/m where y = ywmin ywmin is the minimum value of Y co-ordinate of the window • (d) If bit 4 is "1" line intersects with the top boundary X3=X1+(y-y1)/m where y = ywmax ywmax is the maximum value of Y co-ordinate of the window
  • 18. Text Clipping • A simple method is completely considered, or nothing considers method. • This method is also called as all or none. • If all characters of the string are inside window, then we will keep the string. • If a string character is outside then whole string will be discarded in fig (a).
  • 19. Text Clipping • Another method is discarded those characters not completely inside the window. • If a character overlap boundary of window. Those will be discarded in fig (b). • In fig (c) individual character is treated. Character lies on boundary is discarded as which it is outside the window.
  • 21. Polygon Clipping • Polygon clipping is applied to the polygons. • The term polygon is used to define objects having outline of solid. • These objects should maintain property and shape of polygon after clipping.
  • 22. Sutherland-Hodgeman Polygon Clipping: • It is performed by processing the boundary of polygon against each window corner or edge. • First of all entire polygon is clipped against one edge, then resulting polygon is considered, then the polygon is considered against the second edge, so on for all four edges.
  • 23. Four possible situations while processing • If the first vertex is an outside the window, the second vertex is inside the window. Then second vertex is added to the output list. The point of intersection of window boundary and polygon side (edge) is also added to the output line. • If both vertexes are inside window boundary. Then only second vertex is added to the output list. • If the first vertex is inside the window and second is an outside window. The edge which intersects with window is added to output list. • If both vertices are the outside window, then nothing is added to output list.
  • 25. WINDOW-TO-VIEWPORT COORDINATE TRANSFORMATION • A world-coordinate area selected for display is called a window. • An area on a display device to which a window is mapped is called a viewport. • The window defines what is to be viewed; the viewport defines where it is to be displayed.
  • 26. Viewing transformation or window to viewport transformation or windowing transformation:The mapping of a part of a world-coordinate scene to device coordinates is referred to as a viewing transformation.
  • 27. Viewing transformation in several steps: • First, we construct the scene in world coordinate using the output primitives and attributes. • To obtain a particular orientation, we can set up a 2-D viewing coordinate system in the window coordinate plane and define a window in viewing coordinates system. • Once the viewing frame is established, are then transform description in world coordinates to viewing coordinates.
  • 28. Viewing transformation in several steps: • Then, we define viewport in normalized coordinates (range from 0 to 1) and map the viewing coordinates description of the scene to normalized coordinates. • At the final step, all parts of the picture that (i.e., outside the viewport are dipped, and the contents are transferred to device coordinates).
  • 31. In order to maintain the same relative placement of the point in the viewport as in the window, we require:
  • 32. viewport position (xv, yv), we have: xv=xvmin+(xw-xwmin)sx yv=yvmin+(yw-ywmin)sy ...........equation 2 Where scaling factors are
  • 33. Equation (1) and Equation (2) can also be derived with a set of transformation that converts the window or world coordinate area into the viewport or screen coordinate area.
  • 34. This conversation is performed with the following sequence of transformations: Perform a scaling transformation using a fixed point position (xwmin,ywmin) that scales the window area to the size of the viewport. Translate the scaled window area to the position of the viewport. Relative proportions of objects are maintained if the scaling factors are the same (sx=sy).