SlideShare a Scribd company logo
1 of 22
2D Viewing & Clipping
1
Presented by:
Abu Nayeem ID: 172015012
Jahurul Islam ID: 172015013
Md. Al-Amin ID: 172015031
Belayet Hossain ID: 172015032
Guided by:
Prof. Dr. Md. Zahidul Islam
Designation: Professor
Green University of Bangladesh
Department: CSE
Course Name: Computer Graphics
Course Code: CSE 403
 Definition of Viewing & Clipping?
 Viewing pipeline
 Viewing transformation system
 Several types of clipping
 Cohen-Sutherland Line Clipping
 Application of Clipping
 Conclusion
Outline
2
The two dimensional viewing is a transformation process of real world object into position point which
is relative to the viewing volume, especially, the points behind the viewer.
2D Viewing
3
Viewing Pipeline
 Window
 a world-coordinate area selected for display
 define what is to be viewed
 View port
 area on a display device which a window is mapped
 define where it is to be displayed
 Windows & viewport
 be rectangles in standard position, with the
rectangle edges parallel to the coordinate
axes
 other geometries : take longer to process
4
 The process of mapping a part of the world co-ordinate scene to device co-ordinate system is
known as viewing transformation.
 A world co-ordinate area selected for display is called as a window and an area on display device
to which a window is mapped is called as a view point.
Viewing transformation system
 Window defines ‘What’ to be viewed
and the viewport defines ‘Where’ it is
to be displayed
5
Any Procedure that identifies those portions of a picture that are either insider
outside of a specified region of a space is referred to as a Clipping algorithm or
simply Clipping.
Clipping
Clipping is a computer graphics process to remove the lines, objects, or line segments, all of which are
outside the viewing region.
6
 Point Clipping
 Line Clipping
 Polygon Clipping
 Curve Clipping
 Text Clipping
Types of Clipping
7
Point Clipping
Point Clipping is used to determining, whether the point is inside the window
or not. For this following conditions are checked.
That’s mean a point P = (x, y)
for display if the following
inequalities are satisfied
Xwmin <= X <= Xwmax
Ywmin <= Y <= Ywmax
where the Xwmin, Ywmin, Xwmax, Ywmax are the edge of the Clip Window.
 x ≤ xmax
 x ≥ xmin
 y ≤ ymax
 y ≥ ymin
8
Line Clipping
Line clipping procedure
 Test a given line segment to determine whether it lies completely inside the clipping window
 If it doesn’t, we try to determine whether it lies completely outside the window
 If we can’t identify a line as completely inside or completely outside, we must perform intersection
calculations with one or more clipping boundaries
It is performed by using the line clipping algorithm. The line clipping algorithms are:
1. Cohen Sutherland Line Clipping Algorithm
2. Midpoint Subdivision Line Clipping Algorithm
3. Liang-Barsky Line Clipping Algorithm
9
Cohen-Sutherland Line Clipping
The Cohen–Sutherland algorithm is a computer-graphics algorithm used for line clipping.The
algorithm divides a two-dimensional space into 9 regions and then efficiently determines the
lines and portions of lines that are visible in the central region of interest (the viewport).
10
Window
ymin
ymax
0000
1000
0100
0001 0010
1001
0101 0110
1010
xmin xmax
Cohen-Sutherland Line Clipping
Window
ymin
ymax
0000
1000
0100
0001 0010
1001
0101 0110
1010
xmin xmax
Region Code Creation
Region Code
Bit 1: left
Bit 2: right
Bit 3: below
Bit 4: above
1 2 3 4
y < ymax
y > ymin
x > xmin x < xmax
=interior
xmin xmax
ymin
ymax
11
Cohen-Sutherland Line Clipping
Cohen-Sutherland line clipping remember part
Calculate Intersection Point
 Using the slope-intercept form 0
0
xx
yy
m
end
end



)( 11 xxmyy 
m
yy
xx 1
1


To find y value 
To find x value 
12
A(-4,2)
B(-1,7)
Xmin=-3
Ymin = 1
Ymax = 6
Example
Cohen-Sutherland Line Clipping
Xmax=2
13
A(-4,2)
B(-1,7)
Xmin=-3 Xmax=2
Ymin = 1
Ymax = 6
bit 4 : bit 3 : bit 2 : bit 1
Top : Bottom : Right : Left
sign(y-ymax) : sign(ymin-y) : sign(x-xmax) : sign(xmin-x)
from endpoint codes to last point
sign(2-6) : sign(1-2) : sign(-4-2) : sign(-3+4)
<0 : <0 : <0 : >0
0 : 0 : 0 : 1
Bit = true if sign(…) >= 0
Bit = false if sign(…) < 0
A(-4,2)
14
A(-4,2)
B(-1,7)
Xmin=-3 Xmax=2
Ymin = 1
Ymax = 6
bit 4 : bit 3 : bit 2 : bit 1
Top : Bottom : Right : Left
sign(y-6) : sign(1-y) : sign(x-2) : sign(-3-x)
from endpoint codes to last point
sign(7-6) : sign(1-7) : sign(-1-2) : sign(-3+1)
>0 : <0 : <0 : <0
1 : 0 : 0 : 0
Bit = true if sign(…) >= 0
Bit = false if sign(…) < 0
B(-1,7)
15
A:0001
B:1000
Summery of endpoint codes to the last point
A AND B = (0001) & (1000) = 0000  Maybe
16
A(-4,2):0001
B(-1,7):1000
A(-4,2):0001 The first bit is true that the line
was cut at the left edge.
(ymin <= 11/3 <= ymax)
The left is a cutting edge(-3,11/3)
3
5
)4(1
27
0
0







xx
yy
m
end
end
)( 11 xxmyy 
17
  
3
11
43
3
5
2 y
3min  xx
A(-4,2):0001
B(-1,7):1000
B(-1,7):1000 bit 4 is true The line was cut
at the top
(xmin <= -8/5 <= xmax)
Point on the cutting edge (-8/5,6)
3
5
)4(1
27
0
0







xx
yy
m
end
end
m
yy
xx 1
1


18
6max  yy
    













5
8
76
5
3
1x
(-3,11/3)
(-8/5,6)
Xmin=-3 Xmax=2
Ymin = 1
Ymax = 6
19
Application 2D Clipping
 Extracting part of a defined scene for viewing
 Identifying visible surfaces in 2D views
 Antialiasing line segments or object boundaries
 Creating objects using solid-modeling procedures
 Displaying a multi window environment
 Drawing & painting operations that allow parts of a picture to be
selected for copying, moving, erasing, or duplicating
20
Conclusion
Good clipping strategy is important in the development of video games in order to
maximize the game's frame rate and visual quality. Despite GPU chips that are faster
every year, it remains computationally expensive to transform, texture, and shade
polygons, especially with the multiple texture and shading passes common today.
Hence, game developers must live within a certain "budget" of polygons that can be
drawn each video frame.
21
22

More Related Content

What's hot

Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmMaruf Abdullah (Rion)
 
Bezier curve & B spline curve
Bezier curve  & B spline curveBezier curve  & B spline curve
Bezier curve & B spline curveArvind Kumar
 
Bezeir curve na B spline Curve
Bezeir curve na B spline CurveBezeir curve na B spline Curve
Bezeir curve na B spline CurvePooja Dixit
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfacesAnkur Kumar
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfAmol Gaikwad
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmMani Kanth
 
4. THREE DIMENSIONAL DISPLAY METHODS
4.	THREE DIMENSIONAL DISPLAY METHODS4.	THREE DIMENSIONAL DISPLAY METHODS
4. THREE DIMENSIONAL DISPLAY METHODSSanthiNivas
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer GraphicsKamal Acharya
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphicssabbirantor
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fillwahab13
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer GraphicsLaxman Puri
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clippingMani Kanth
 
Hidden lines & surfaces
Hidden lines & surfacesHidden lines & surfaces
Hidden lines & surfacesAnkur Kumar
 
Liang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmLiang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmArvind Kumar
 
Random scan displays and raster scan displays
Random scan displays and raster scan displaysRandom scan displays and raster scan displays
Random scan displays and raster scan displaysSomya Bagai
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithmMani Kanth
 
Clipping Algorithm In Computer Graphics
Clipping Algorithm In Computer GraphicsClipping Algorithm In Computer Graphics
Clipping Algorithm In Computer Graphicsstudent(MCA)
 

What's hot (20)

ANIMATION SEQUENCE
ANIMATION SEQUENCEANIMATION SEQUENCE
ANIMATION SEQUENCE
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Bezier curve & B spline curve
Bezier curve  & B spline curveBezier curve  & B spline curve
Bezier curve & B spline curve
 
Bezeir curve na B spline Curve
Bezeir curve na B spline CurveBezeir curve na B spline Curve
Bezeir curve na B spline Curve
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
The sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithmThe sutherland hodgeman polygon clipping algorithm
The sutherland hodgeman polygon clipping algorithm
 
4. THREE DIMENSIONAL DISPLAY METHODS
4.	THREE DIMENSIONAL DISPLAY METHODS4.	THREE DIMENSIONAL DISPLAY METHODS
4. THREE DIMENSIONAL DISPLAY METHODS
 
Output primitives in Computer Graphics
Output primitives in Computer GraphicsOutput primitives in Computer Graphics
Output primitives in Computer Graphics
 
3D Transformation in Computer Graphics
3D Transformation in Computer Graphics3D Transformation in Computer Graphics
3D Transformation in Computer Graphics
 
Polygon Fill
Polygon FillPolygon Fill
Polygon Fill
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 
Hidden lines & surfaces
Hidden lines & surfacesHidden lines & surfaces
Hidden lines & surfaces
 
Liang barsky Line Clipping Algorithm
Liang barsky Line Clipping AlgorithmLiang barsky Line Clipping Algorithm
Liang barsky Line Clipping Algorithm
 
Bezier Curve
Bezier Curve Bezier Curve
Bezier Curve
 
Random scan displays and raster scan displays
Random scan displays and raster scan displaysRandom scan displays and raster scan displays
Random scan displays and raster scan displays
 
Seed filling algorithm
Seed filling algorithmSeed filling algorithm
Seed filling algorithm
 
3 d display-methods
3 d display-methods3 d display-methods
3 d display-methods
 
Clipping Algorithm In Computer Graphics
Clipping Algorithm In Computer GraphicsClipping Algorithm In Computer Graphics
Clipping Algorithm In Computer Graphics
 

Similar to 2D viewing & clipping

Unit 3
Unit 3Unit 3
Unit 3ypnrao
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptxRYZEN14
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphicsShaishavShah8
 
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
 
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
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clippingShweta Shah
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping2013901097
 
10CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 510CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 5Vanishree Arun
 
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
 

Similar to 2D viewing & clipping (20)

Clipping
ClippingClipping
Clipping
 
Unit 3
Unit 3Unit 3
Unit 3
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 
Clipping 22
Clipping 22Clipping 22
Clipping 22
 
Unit2- line clipping.pptx
Unit2- line clipping.pptxUnit2- line clipping.pptx
Unit2- line clipping.pptx
 
Clipping computer graphics
Clipping  computer graphicsClipping  computer graphics
Clipping computer graphics
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )Clipping ( Cohen-Sutherland Algorithm )
Clipping ( Cohen-Sutherland Algorithm )
 
Clipping
ClippingClipping
Clipping
 
Clipping
ClippingClipping
Clipping
 
line clipping
line clipping line clipping
line clipping
 
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
 
raster algorithm.pdf
raster algorithm.pdfraster algorithm.pdf
raster algorithm.pdf
 
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
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
Computer Graphics - clipping
Computer Graphics - clippingComputer Graphics - clipping
Computer Graphics - clipping
 
Computer Graphic - Clipping
Computer Graphic - ClippingComputer Graphic - Clipping
Computer Graphic - Clipping
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
10CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 510CSL67 CG LAB PROGRAM 5
10CSL67 CG LAB PROGRAM 5
 
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
 

More from MdAlAmin187

Decision tree in artificial intelligence
Decision tree in artificial intelligenceDecision tree in artificial intelligence
Decision tree in artificial intelligenceMdAlAmin187
 
Assignment on field study of Mahera & Pakutia Jomidar Bari
Assignment on field study of Mahera & Pakutia Jomidar BariAssignment on field study of Mahera & Pakutia Jomidar Bari
Assignment on field study of Mahera & Pakutia Jomidar BariMdAlAmin187
 
Social problems in Bangladesh
Social problems in BangladeshSocial problems in Bangladesh
Social problems in BangladeshMdAlAmin187
 
History of Language & History of Bangla Language
History of Language & History of Bangla LanguageHistory of Language & History of Bangla Language
History of Language & History of Bangla LanguageMdAlAmin187
 
Lu Decomposition
Lu DecompositionLu Decomposition
Lu DecompositionMdAlAmin187
 
Non Linear Equation
Non Linear EquationNon Linear Equation
Non Linear EquationMdAlAmin187
 
Smart home technology LaTeX paper
Smart home technology LaTeX paperSmart home technology LaTeX paper
Smart home technology LaTeX paperMdAlAmin187
 
Emo 8086 code for Loop
Emo 8086 code for LoopEmo 8086 code for Loop
Emo 8086 code for LoopMdAlAmin187
 
Emo 8086 code for add
Emo 8086 code for addEmo 8086 code for add
Emo 8086 code for addMdAlAmin187
 
Emo 8086 code for Subtraction
Emo 8086 code for SubtractionEmo 8086 code for Subtraction
Emo 8086 code for SubtractionMdAlAmin187
 
Virtual local area network(VLAN)
Virtual local area network(VLAN)Virtual local area network(VLAN)
Virtual local area network(VLAN)MdAlAmin187
 
Telnet configuration
Telnet configurationTelnet configuration
Telnet configurationMdAlAmin187
 
Standard & Extended ACL Configuration
Standard & Extended ACL ConfigurationStandard & Extended ACL Configuration
Standard & Extended ACL ConfigurationMdAlAmin187
 
Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...MdAlAmin187
 
Topological Sort
Topological SortTopological Sort
Topological SortMdAlAmin187
 
Verification of Solenoidal & Irrotational
Verification of Solenoidal & IrrotationalVerification of Solenoidal & Irrotational
Verification of Solenoidal & IrrotationalMdAlAmin187
 
Bangla spell checker & suggestion generator
Bangla spell checker & suggestion generatorBangla spell checker & suggestion generator
Bangla spell checker & suggestion generatorMdAlAmin187
 
Different types of DBMS
Different types of DBMSDifferent types of DBMS
Different types of DBMSMdAlAmin187
 
Discrete mathematics
Discrete mathematicsDiscrete mathematics
Discrete mathematicsMdAlAmin187
 
Math presentation
Math presentationMath presentation
Math presentationMdAlAmin187
 

More from MdAlAmin187 (20)

Decision tree in artificial intelligence
Decision tree in artificial intelligenceDecision tree in artificial intelligence
Decision tree in artificial intelligence
 
Assignment on field study of Mahera & Pakutia Jomidar Bari
Assignment on field study of Mahera & Pakutia Jomidar BariAssignment on field study of Mahera & Pakutia Jomidar Bari
Assignment on field study of Mahera & Pakutia Jomidar Bari
 
Social problems in Bangladesh
Social problems in BangladeshSocial problems in Bangladesh
Social problems in Bangladesh
 
History of Language & History of Bangla Language
History of Language & History of Bangla LanguageHistory of Language & History of Bangla Language
History of Language & History of Bangla Language
 
Lu Decomposition
Lu DecompositionLu Decomposition
Lu Decomposition
 
Non Linear Equation
Non Linear EquationNon Linear Equation
Non Linear Equation
 
Smart home technology LaTeX paper
Smart home technology LaTeX paperSmart home technology LaTeX paper
Smart home technology LaTeX paper
 
Emo 8086 code for Loop
Emo 8086 code for LoopEmo 8086 code for Loop
Emo 8086 code for Loop
 
Emo 8086 code for add
Emo 8086 code for addEmo 8086 code for add
Emo 8086 code for add
 
Emo 8086 code for Subtraction
Emo 8086 code for SubtractionEmo 8086 code for Subtraction
Emo 8086 code for Subtraction
 
Virtual local area network(VLAN)
Virtual local area network(VLAN)Virtual local area network(VLAN)
Virtual local area network(VLAN)
 
Telnet configuration
Telnet configurationTelnet configuration
Telnet configuration
 
Standard & Extended ACL Configuration
Standard & Extended ACL ConfigurationStandard & Extended ACL Configuration
Standard & Extended ACL Configuration
 
Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...Chosse a best algorithm for page replacement to reduce page fault and analysi...
Chosse a best algorithm for page replacement to reduce page fault and analysi...
 
Topological Sort
Topological SortTopological Sort
Topological Sort
 
Verification of Solenoidal & Irrotational
Verification of Solenoidal & IrrotationalVerification of Solenoidal & Irrotational
Verification of Solenoidal & Irrotational
 
Bangla spell checker & suggestion generator
Bangla spell checker & suggestion generatorBangla spell checker & suggestion generator
Bangla spell checker & suggestion generator
 
Different types of DBMS
Different types of DBMSDifferent types of DBMS
Different types of DBMS
 
Discrete mathematics
Discrete mathematicsDiscrete mathematics
Discrete mathematics
 
Math presentation
Math presentationMath presentation
Math presentation
 

Recently uploaded

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile servicerehmti665
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130Suhani Kapoor
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations120cr0395
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingrakeshbaidya232001
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxupamatechverse
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝soniya singh
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Serviceranjana rawat
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Dr.Costas Sachpazis
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxpranjaldaimarysona
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidNikhilNagaraju
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAbhinavSharma374939
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)Suman Mia
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSSIVASHANKAR N
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxAsutosh Ranjan
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSRajkumarAkumalla
 

Recently uploaded (20)

Call Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile serviceCall Girls Delhi {Jodhpur} 9711199012 high profile service
Call Girls Delhi {Jodhpur} 9711199012 high profile service
 
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
★ CALL US 9953330565 ( HOT Young Call Girls In Badarpur delhi NCR
 
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
VIP Call Girls Service Hitech City Hyderabad Call +91-8250192130
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Porous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writingPorous Ceramics seminar and technical writing
Porous Ceramics seminar and technical writing
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
Introduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptxIntroduction and different types of Ethernet.pptx
Introduction and different types of Ethernet.pptx
 
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
Model Call Girl in Narela Delhi reach out to us at 🔝8264348440🔝
 
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
(RIA) Call Girls Bhosari ( 7001035870 ) HI-Fi Pune Escorts Service
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
Processing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptxProcessing & Properties of Floor and Wall Tiles.pptx
Processing & Properties of Floor and Wall Tiles.pptx
 
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptxExploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
Exploring_Network_Security_with_JA3_by_Rakesh Seal.pptx
 
main PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfidmain PPT.pptx of girls hostel security using rfid
main PPT.pptx of girls hostel security using rfid
 
Analog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog ConverterAnalog to Digital and Digital to Analog Converter
Analog to Digital and Digital to Analog Converter
 
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)Software Development Life Cycle By  Team Orange (Dept. of Pharmacy)
Software Development Life Cycle By Team Orange (Dept. of Pharmacy)
 
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
9953056974 Call Girls In South Ex, Escorts (Delhi) NCR.pdf
 
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLSMANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
MANUFACTURING PROCESS-II UNIT-5 NC MACHINE TOOLS
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICSHARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
HARDNESS, FRACTURE TOUGHNESS AND STRENGTH OF CERAMICS
 
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINEDJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
DJARUM4D - SLOT GACOR ONLINE | SLOT DEMO ONLINE
 

2D viewing & clipping

  • 1. 2D Viewing & Clipping 1 Presented by: Abu Nayeem ID: 172015012 Jahurul Islam ID: 172015013 Md. Al-Amin ID: 172015031 Belayet Hossain ID: 172015032 Guided by: Prof. Dr. Md. Zahidul Islam Designation: Professor Green University of Bangladesh Department: CSE Course Name: Computer Graphics Course Code: CSE 403
  • 2.  Definition of Viewing & Clipping?  Viewing pipeline  Viewing transformation system  Several types of clipping  Cohen-Sutherland Line Clipping  Application of Clipping  Conclusion Outline 2
  • 3. The two dimensional viewing is a transformation process of real world object into position point which is relative to the viewing volume, especially, the points behind the viewer. 2D Viewing 3
  • 4. Viewing Pipeline  Window  a world-coordinate area selected for display  define what is to be viewed  View port  area on a display device which a window is mapped  define where it is to be displayed  Windows & viewport  be rectangles in standard position, with the rectangle edges parallel to the coordinate axes  other geometries : take longer to process 4
  • 5.  The process of mapping a part of the world co-ordinate scene to device co-ordinate system is known as viewing transformation.  A world co-ordinate area selected for display is called as a window and an area on display device to which a window is mapped is called as a view point. Viewing transformation system  Window defines ‘What’ to be viewed and the viewport defines ‘Where’ it is to be displayed 5
  • 6. Any Procedure that identifies those portions of a picture that are either insider outside of a specified region of a space is referred to as a Clipping algorithm or simply Clipping. Clipping Clipping is a computer graphics process to remove the lines, objects, or line segments, all of which are outside the viewing region. 6
  • 7.  Point Clipping  Line Clipping  Polygon Clipping  Curve Clipping  Text Clipping Types of Clipping 7
  • 8. Point Clipping Point Clipping is used to determining, whether the point is inside the window or not. For this following conditions are checked. That’s mean a point P = (x, y) for display if the following inequalities are satisfied Xwmin <= X <= Xwmax Ywmin <= Y <= Ywmax where the Xwmin, Ywmin, Xwmax, Ywmax are the edge of the Clip Window.  x ≤ xmax  x ≥ xmin  y ≤ ymax  y ≥ ymin 8
  • 9. Line Clipping Line clipping procedure  Test a given line segment to determine whether it lies completely inside the clipping window  If it doesn’t, we try to determine whether it lies completely outside the window  If we can’t identify a line as completely inside or completely outside, we must perform intersection calculations with one or more clipping boundaries It is performed by using the line clipping algorithm. The line clipping algorithms are: 1. Cohen Sutherland Line Clipping Algorithm 2. Midpoint Subdivision Line Clipping Algorithm 3. Liang-Barsky Line Clipping Algorithm 9
  • 10. Cohen-Sutherland Line Clipping The Cohen–Sutherland algorithm is a computer-graphics algorithm used for line clipping.The algorithm divides a two-dimensional space into 9 regions and then efficiently determines the lines and portions of lines that are visible in the central region of interest (the viewport). 10 Window ymin ymax 0000 1000 0100 0001 0010 1001 0101 0110 1010 xmin xmax
  • 11. Cohen-Sutherland Line Clipping Window ymin ymax 0000 1000 0100 0001 0010 1001 0101 0110 1010 xmin xmax Region Code Creation Region Code Bit 1: left Bit 2: right Bit 3: below Bit 4: above 1 2 3 4 y < ymax y > ymin x > xmin x < xmax =interior xmin xmax ymin ymax 11
  • 12. Cohen-Sutherland Line Clipping Cohen-Sutherland line clipping remember part Calculate Intersection Point  Using the slope-intercept form 0 0 xx yy m end end    )( 11 xxmyy  m yy xx 1 1   To find y value  To find x value  12
  • 13. A(-4,2) B(-1,7) Xmin=-3 Ymin = 1 Ymax = 6 Example Cohen-Sutherland Line Clipping Xmax=2 13
  • 14. A(-4,2) B(-1,7) Xmin=-3 Xmax=2 Ymin = 1 Ymax = 6 bit 4 : bit 3 : bit 2 : bit 1 Top : Bottom : Right : Left sign(y-ymax) : sign(ymin-y) : sign(x-xmax) : sign(xmin-x) from endpoint codes to last point sign(2-6) : sign(1-2) : sign(-4-2) : sign(-3+4) <0 : <0 : <0 : >0 0 : 0 : 0 : 1 Bit = true if sign(…) >= 0 Bit = false if sign(…) < 0 A(-4,2) 14
  • 15. A(-4,2) B(-1,7) Xmin=-3 Xmax=2 Ymin = 1 Ymax = 6 bit 4 : bit 3 : bit 2 : bit 1 Top : Bottom : Right : Left sign(y-6) : sign(1-y) : sign(x-2) : sign(-3-x) from endpoint codes to last point sign(7-6) : sign(1-7) : sign(-1-2) : sign(-3+1) >0 : <0 : <0 : <0 1 : 0 : 0 : 0 Bit = true if sign(…) >= 0 Bit = false if sign(…) < 0 B(-1,7) 15
  • 16. A:0001 B:1000 Summery of endpoint codes to the last point A AND B = (0001) & (1000) = 0000  Maybe 16
  • 17. A(-4,2):0001 B(-1,7):1000 A(-4,2):0001 The first bit is true that the line was cut at the left edge. (ymin <= 11/3 <= ymax) The left is a cutting edge(-3,11/3) 3 5 )4(1 27 0 0        xx yy m end end )( 11 xxmyy  17    3 11 43 3 5 2 y 3min  xx
  • 18. A(-4,2):0001 B(-1,7):1000 B(-1,7):1000 bit 4 is true The line was cut at the top (xmin <= -8/5 <= xmax) Point on the cutting edge (-8/5,6) 3 5 )4(1 27 0 0        xx yy m end end m yy xx 1 1   18 6max  yy                   5 8 76 5 3 1x
  • 20. Application 2D Clipping  Extracting part of a defined scene for viewing  Identifying visible surfaces in 2D views  Antialiasing line segments or object boundaries  Creating objects using solid-modeling procedures  Displaying a multi window environment  Drawing & painting operations that allow parts of a picture to be selected for copying, moving, erasing, or duplicating 20
  • 21. Conclusion Good clipping strategy is important in the development of video games in order to maximize the game's frame rate and visual quality. Despite GPU chips that are faster every year, it remains computationally expensive to transform, texture, and shade polygons, especially with the multiple texture and shading passes common today. Hence, game developers must live within a certain "budget" of polygons that can be drawn each video frame. 21
  • 22. 22