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

Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unitaravindangc
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clippingMani Kanth
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithmAparna Joshi
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removalAnkit Garg
 
Back face detection
Back face detectionBack face detection
Back face detectionPooja Dixit
 
Bezier curve & B spline curve
Bezier curve  & B spline curveBezier curve  & B spline curve
Bezier curve & B spline curveArvind Kumar
 
Raster scan system
Raster scan systemRaster scan system
Raster scan systemMohd Arif
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTAhtesham Ullah khan
 
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
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfacesAnkur Kumar
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive SachiniGunawardana
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfacesMohd Arif
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphicsSHIVANI SONI
 

What's hot (20)

lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 lecture2  computer graphics graphics hardware(Computer graphics tutorials) lecture2  computer graphics graphics hardware(Computer graphics tutorials)
lecture2 computer graphics graphics hardware(Computer graphics tutorials)
 
ANIMATION SEQUENCE
ANIMATION SEQUENCEANIMATION SEQUENCE
ANIMATION SEQUENCE
 
Computer graphics iv unit
Computer graphics iv unitComputer graphics iv unit
Computer graphics iv unit
 
Cohen sutherland line clipping
Cohen sutherland line clippingCohen sutherland line clipping
Cohen sutherland line clipping
 
Graphics a buffer
Graphics a bufferGraphics a buffer
Graphics a buffer
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
Hidden surface removal
Hidden surface removalHidden surface removal
Hidden surface removal
 
Back face detection
Back face detectionBack face detection
Back face detection
 
Bezier curve & B spline curve
Bezier curve  & B spline curveBezier curve  & B spline curve
Bezier curve & B spline curve
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPTHOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
HOMOGENEOUS CO-ORDINATES IN COMPUTER GRAPHICS PPT
 
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
 
Quadric surfaces
Quadric surfacesQuadric surfaces
Quadric surfaces
 
Halftoning in Computer Graphics
Halftoning  in Computer GraphicsHalftoning  in Computer Graphics
Halftoning in Computer Graphics
 
Dda algorithm
Dda algorithmDda algorithm
Dda algorithm
 
Frame buffer
Frame bufferFrame buffer
Frame buffer
 
Attributes of output Primitive
Attributes of output Primitive Attributes of output Primitive
Attributes of output Primitive
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
3 d display-methods
3 d display-methods3 d display-methods
3 d display-methods
 

Similar to 2D viewing & clipping

Similar to 2D viewing & clipping (20)

Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
 
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
 
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
 

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

Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort servicejennyeacort
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxJoão Esperancinha
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)dollysharma2066
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024Mark Billinghurst
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...srsj9000
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIkoyaldeepu123
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptSAURABHKUMAR892774
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)Dr SOUNDIRARAJ N
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxPoojaBan
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfAsst.prof M.Gokilavani
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHC Sai Kiran
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfROCENODodongVILLACER
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfme23b1001
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture designssuser87fa0c1
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AIabhishek36461
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerAnamika Sarkar
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionDr.Costas Sachpazis
 

Recently uploaded (20)

young call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Serviceyoung call girls in Green Park🔝 9953056974 🔝 escort Service
young call girls in Green Park🔝 9953056974 🔝 escort Service
 
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort serviceGurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
Gurgaon ✡️9711147426✨Call In girls Gurgaon Sector 51 escort service
 
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptxDecoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
Decoding Kotlin - Your guide to solving the mysterious in Kotlin.pptx
 
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
Call Us ≽ 8377877756 ≼ Call Girls In Shastri Nagar (Delhi)
 
IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024IVE Industry Focused Event - Defence Sector 2024
IVE Industry Focused Event - Defence Sector 2024
 
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
Gfe Mayur Vihar Call Girls Service WhatsApp -> 9999965857 Available 24x7 ^ De...
 
EduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AIEduAI - E learning Platform integrated with AI
EduAI - E learning Platform integrated with AI
 
Arduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.pptArduino_CSE ece ppt for working and principal of arduino.ppt
Arduino_CSE ece ppt for working and principal of arduino.ppt
 
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
UNIT III ANALOG ELECTRONICS (BASIC ELECTRONICS)
 
Heart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptxHeart Disease Prediction using machine learning.pptx
Heart Disease Prediction using machine learning.pptx
 
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdfCCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
CCS355 Neural Network & Deep Learning UNIT III notes and Question bank .pdf
 
Introduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECHIntroduction to Machine Learning Unit-3 for II MECH
Introduction to Machine Learning Unit-3 for II MECH
 
Risk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdfRisk Assessment For Installation of Drainage Pipes.pdf
Risk Assessment For Installation of Drainage Pipes.pdf
 
Electronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdfElectronically Controlled suspensions system .pdf
Electronically Controlled suspensions system .pdf
 
pipeline in computer architecture design
pipeline in computer architecture  designpipeline in computer architecture  design
pipeline in computer architecture design
 
POWER SYSTEMS-1 Complete notes examples
POWER SYSTEMS-1 Complete notes  examplesPOWER SYSTEMS-1 Complete notes  examples
POWER SYSTEMS-1 Complete notes examples
 
Past, Present and Future of Generative AI
Past, Present and Future of Generative AIPast, Present and Future of Generative AI
Past, Present and Future of Generative AI
 
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube ExchangerStudy on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
Study on Air-Water & Water-Water Heat Exchange in a Finned Tube Exchanger
 
Design and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdfDesign and analysis of solar grass cutter.pdf
Design and analysis of solar grass cutter.pdf
 
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective IntroductionSachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
Sachpazis Costas: Geotechnical Engineering: A student's Perspective Introduction
 

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