SlideShare ist ein Scribd-Unternehmen logo
1 von 35
Downloaden Sie, um offline zu lesen
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

Weitere ähnliche Inhalte

Was ist angesagt?

Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer GraphicsLaxman Puri
 
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
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingMohd Arif
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithmMani Kanth
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output PrimitivesRenita Santhmayora
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithmnehrurevathy
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clippingAnkit Garg
 
Composite transformations
Composite transformationsComposite transformations
Composite transformationsMohd Arif
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingArvind Kumar
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.Mohd Arif
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fillwahab13
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithmAparna Joshi
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmMani Kanth
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformationSelvakumar Gna
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithmMani Kanth
 
Polygon filling
Polygon fillingPolygon filling
Polygon fillingAnkit Garg
 

Was ist angesagt? (20)

Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
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
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
 
Attributes of Output Primitives
Attributes of Output PrimitivesAttributes of Output Primitives
Attributes of Output Primitives
 
Bresenham's line drawing algorithm
Bresenham's line drawing algorithmBresenham's line drawing algorithm
Bresenham's line drawing algorithm
 
Polygon clipping
Polygon clippingPolygon clipping
Polygon clipping
 
Composite transformations
Composite transformationsComposite transformations
Composite transformations
 
sutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clippingsutherland- Hodgeman Polygon clipping
sutherland- Hodgeman Polygon clipping
 
Circle drawing algo.
Circle drawing algo.Circle drawing algo.
Circle drawing algo.
 
Boundary fill algm
Boundary fill algmBoundary fill algm
Boundary fill algm
 
Computer Graphics - clipping
Computer Graphics - clippingComputer Graphics - clipping
Computer Graphics - clipping
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fill
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
Clipping
ClippingClipping
Clipping
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithm
 
Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Mid point circle algorithm
Mid point circle algorithmMid point circle algorithm
Mid point circle algorithm
 
3 d display-methods
3 d display-methods3 d display-methods
3 d display-methods
 
Polygon filling
Polygon fillingPolygon filling
Polygon filling
 

Ähnlich wie 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
 

Ähnlich wie 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
 
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
 
ibuib.pptx
ibuib.pptxibuib.pptx
ibuib.pptx
 

Kürzlich hochgeladen

DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfChristalin Nelson
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxkarenfajardo43
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptxmary850239
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...Nguyen Thanh Tu Collection
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptxDhatriParmar
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...Nguyen Thanh Tu Collection
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEMISSRITIMABIOLOGYEXP
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Osopher
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWQuiz Club NITW
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesVijayaLaxmi84
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxMadhavi Dharankar
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6Vanessa Camilleri
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroomSamsung Business USA
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxSayali Powar
 
BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...
BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...
BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...Nguyen Thanh Tu Collection
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...DhatriParmar
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfChristalin Nelson
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfChristalin Nelson
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPCeline George
 

Kürzlich hochgeladen (20)

DiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdfDiskStorage_BasicFileStructuresandHashing.pdf
DiskStorage_BasicFileStructuresandHashing.pdf
 
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptxGrade Three -ELLNA-REVIEWER-ENGLISH.pptx
Grade Three -ELLNA-REVIEWER-ENGLISH.pptx
 
4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx4.11.24 Poverty and Inequality in America.pptx
4.11.24 Poverty and Inequality in America.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
BÀI TẬP BỔ TRỢ TIẾNG ANH 8 - I-LEARN SMART WORLD - CẢ NĂM - CÓ FILE NGHE (BẢN...
 
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
Unraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptxUnraveling Hypertext_ Analyzing  Postmodern Elements in  Literature.pptx
Unraveling Hypertext_ Analyzing Postmodern Elements in Literature.pptx
 
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
BÀI TẬP BỔ TRỢ TIẾNG ANH 11 THEO ĐƠN VỊ BÀI HỌC - CẢ NĂM - CÓ FILE NGHE (GLOB...
 
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFEPART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
PART 1 - CHAPTER 1 - CELL THE FUNDAMENTAL UNIT OF LIFE
 
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
Healthy Minds, Flourishing Lives: A Philosophical Approach to Mental Health a...
 
Mythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITWMythology Quiz-4th April 2024, Quiz Club NITW
Mythology Quiz-4th April 2024, Quiz Club NITW
 
Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,Spearman's correlation,Formula,Advantages,
Spearman's correlation,Formula,Advantages,
 
Sulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their usesSulphonamides, mechanisms and their uses
Sulphonamides, mechanisms and their uses
 
Objectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptxObjectives n learning outcoms - MD 20240404.pptx
Objectives n learning outcoms - MD 20240404.pptx
 
ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6ICS 2208 Lecture Slide Notes for Topic 6
ICS 2208 Lecture Slide Notes for Topic 6
 
6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom6 ways Samsung’s Interactive Display powered by Android changes the classroom
6 ways Samsung’s Interactive Display powered by Android changes the classroom
 
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptxBIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
BIOCHEMISTRY-CARBOHYDRATE METABOLISM CHAPTER 2.pptx
 
BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...
BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...
BÀI TẬP BỔ TRỢ 4 KĨ NĂNG TIẾNG ANH LỚP 8 - CẢ NĂM - GLOBAL SUCCESS - NĂM HỌC ...
 
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
Blowin' in the Wind of Caste_ Bob Dylan's Song as a Catalyst for Social Justi...
 
Indexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdfIndexing Structures in Database Management system.pdf
Indexing Structures in Database Management system.pdf
 
DBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdfDBMSArchitecture_QueryProcessingandOptimization.pdf
DBMSArchitecture_QueryProcessingandOptimization.pdf
 
An Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERPAn Overview of the Calendar App in Odoo 17 ERP
An Overview of the Calendar App in Odoo 17 ERP
 

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).