SlideShare a Scribd company logo
2D Viewing
Arambam Neelima
Dept of CSE, NIT Nagaland
Clipping
• The technique for not showing the part of the
picture in which one is not interested is called
as clipping.
• A graphics package allows a user to specify
which part of a defined picture is to be
displayed and where that part is to be placed
on the display device
• A view for a 2D picture is selected by specifying a
region of the xy plane that contains the total
picture or any part of it
• select parts of Picture areas are then mapped
onto specified areas of the device coordinates
• 2D viewing transformations from world to device
coordinates involve translation, rotation, and
scaling operations, as well as procedures for
deleting those parts of the picture that are
outside the limits of a selected scene area
Co-ordinate system
• World Co-ordinate System: Right handed
cartesian co-ordinate system in which we
describe the co-ordinates of the picture to be
displayed.
• Device Co-ordinate System: Co-ordinate
system corresponding to the device in which
we want to display.
Viewing transformation system
• 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.
• Window defines ‘What’ to be viewed and the
viewport defines ‘Where’ it is to be displayed
Window
Object in World Co-
ordinate system
Object in Device co-
ordinate system
• Case I: If we change the position of the window
keeping the viewport location constant then the
different part of the object is displayed at the
same position on the display device
• Case II: If we change the location of the viewport
but keep the window constant then the same
part of the object is drawn at different place.
• Changing the size of viewports, we can change
the size and proportions of displayed objects;
zoom in and zoom out effects
Normalization
Normalization: Specify coordinate values between 0 and1
• normalization and window to viewport
transformations can be combined into one operation.
• In this case, the viewport coordinates in the range from
0 to 1 so that the viewport is positioned within a unit
square
• Unit square containing the viewport is mapped to the
outputdisplay device
• normalization and clipping routines are applied before
the viewport transformation
• Object descriptions are transferred to this normalized space
using a transformation that maintains the same relative
placement of a point in the viewport as it had in the clipping
window
• Position (xw, yw) in the clipping window is mapped to position
(xv, yv) in the associated viewport
• To transform the world-coordinate point into
the same relative position within the
viewport, we require,
• Solving these equations for xv and yv
where
• Window to viewport
 Window-to-viewport transformation
 Relative placement of object descriptions is maintained
 Relative proportions of objects, on the other hand, are
maintained only if the aspect ratio of viewport is same as
that of clipping window i.e. sx = sy
 Else, world objects will be stretched or contracted in
either the x or y directions (or both) when displayed on the
output device
• Clipping window to normalized viewport
 clipping routines can be applied using either the
clipping window boundaries or the viewport boundaries
 normalized coordinates are transformed into device
coordinates
 the unit square can be mapped onto the output device
by translation and scaling
Point Clipping
• Given a clipping rectangle in standard
position, we save a two-dimensional point P =
(x, y) for display if
• If any of these inequalities is not satisfied, the
point is clipped i.e. not saved for display
Line Clipping
• A line-clipping algorithm processes each line
in a scene to determine whether the entire
line or any part of it is to be saved for display
• Line Clipping
• Need to compute intersection points of lines
with clipping window
• minimize intersection calculation for better
algorithm
• Test whether a line segment is completely inside
the clipping window or completely outside
• Completely inside – easy; both points are inside
– P1P2
• Completely outside – difficult; both points
outside?? – P3P4
• If not possible –Test whether any part of a line
crosses the window interior
COHEN SUTHERLAND LINE CLIPPING
One of the earliest algorithms for fast line clipping
• Processing time is reduced by performing more tests
before proceeding to the intersection calculations
• Every line endpoint in a picture is assigned a four-bit
binary value – region code
• Each bit position is used to indicate whether the point
is inside or outside one of the clipping-window
boundaries
Bit 4 Bit 3 Bit 2 Bit 1
Bottom Right LeftTop
Bit 1 is set to 1 when point lies
to left of the window
Bit 2 is set to 1 when point lies
to right of the window
Bit 3 is set to 1 when point lies
below/bottom of window
Bit 4 is set to 1 when point lies
above the window
• Bit values in a region code determined by
comparing the
• coordinate values (x, y) endpoints to the clipping
boundaries
• Bit 1 is set to 1 if x < xwmin
• Bit 2 is set to 1 if x > xwmax
• Bit 3 is set to 1 if y < ywmin
• Bit 4 is set to 1 if y > ywmax
• Calculate differences between endpoint
coordinates and clipping boundaries.
• Use the resultant sign bit of each difference
calculation to set
• the corresponding value in the region code.
• For any given line,
• If both endpoints have region code 0000 – completely
inside
• If both endpoints has a region-code value of 1 in at
least one same bit position – completely outside the
clipping rectangle, and we eliminate that line segment
• Lines that cannot be identified as completely inside or
completely outside are checked for intersections
• As each clipping-window edge is processed, a section
of the line is clipped, and remaining part of the line is
checked against the other window borders
• Eliminate sections until either the line is totally clipped
or the remaining part of the line is inside the clipping
window.
• To determine a boundary intersections, use the slope
intercept form of the line equation
• For a line with endpoint coordinates (x0, y0) and (xend,
yend),
• For intersection point with a vertical clipping border line,
ycoordinate is obtained with the calculation
where the x value is set to either xwmin or xwmax
• Similarly, for intersection with a horizontal border, the
xcoordinate is calculated as
with y set either to ywmin or to ywmax
• Use Cohen Sutherland algorithm to clip the
line P(70,20) and Q(100,10) against a window
lower left hand corner (50,10) and upper right
hand corner (80,40).
(70,20) and (80, 16.667)

More Related Content

What's hot

Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
Selvakumar Gna
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
Sanu Philip
 
Back face detection
Back face detectionBack face detection
Back face detection
Pooja Dixit
 
Raster scan system
Raster scan systemRaster scan system
Raster scan systemMohd Arif
 
Clipping
ClippingClipping
Clipping
AMIT VIRAMGAMI
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfacesMohd Arif
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
Laxman Puri
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
Timbal Mayank
 
3 d display methods
3 d display methods3 d display methods
3 d display methods
Shami Al Rahad
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
MdAlAmin187
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
PrathimaBaliga
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
Maruf Abdullah (Rion)
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
Aparna Joshi
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
shalinikarunakaran1
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
Ummiya Mohammedi
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
Kamal Acharya
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
Pooja Dixit
 
UNIT-IV
UNIT-IVUNIT-IV
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
Somya Bagai
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformationsMohammad Sadiq
 

What's hot (20)

Computer graphics basic transformation
Computer graphics basic transformationComputer graphics basic transformation
Computer graphics basic transformation
 
Projection In Computer Graphics
Projection In Computer GraphicsProjection In Computer Graphics
Projection In Computer Graphics
 
Back face detection
Back face detectionBack face detection
Back face detection
 
Raster scan system
Raster scan systemRaster scan system
Raster scan system
 
Clipping
ClippingClipping
Clipping
 
Hidden surfaces
Hidden surfacesHidden surfaces
Hidden surfaces
 
Clipping in Computer Graphics
Clipping in Computer GraphicsClipping in Computer Graphics
Clipping in Computer Graphics
 
2D transformation (Computer Graphics)
2D transformation (Computer Graphics)2D transformation (Computer Graphics)
2D transformation (Computer Graphics)
 
3 d display methods
3 d display methods3 d display methods
3 d display methods
 
2D viewing & clipping
2D viewing & clipping2D viewing & clipping
2D viewing & clipping
 
Computer graphics chapter 4
Computer graphics chapter 4Computer graphics chapter 4
Computer graphics chapter 4
 
Cohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping AlgorithmCohen-Sutherland Line Clipping Algorithm
Cohen-Sutherland Line Clipping Algorithm
 
Polygon filling algorithm
Polygon filling algorithmPolygon filling algorithm
Polygon filling algorithm
 
Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)Attributes of output primitives( curve attributes & area fill attributes)
Attributes of output primitives( curve attributes & area fill attributes)
 
Depth Buffer Method
Depth Buffer MethodDepth Buffer Method
Depth Buffer Method
 
Overview of the graphics system
Overview of the graphics systemOverview of the graphics system
Overview of the graphics system
 
Cyrus beck line clipping algorithm
Cyrus beck line clipping algorithmCyrus beck line clipping algorithm
Cyrus beck line clipping algorithm
 
UNIT-IV
UNIT-IVUNIT-IV
UNIT-IV
 
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
 
Two dimensional geometric transformations
Two dimensional geometric transformationsTwo dimensional geometric transformations
Two dimensional geometric transformations
 

Viewers also liked

2D viewing
2D viewing2D viewing
2D viewing
HiteshJain007
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
majicyoung
 
Windows to viewport transformation
Windows to viewport transformationWindows to viewport transformation
Windows to viewport transformation
Prashant Singh
 
Lect7 viewing in2d
Lect7 viewing in2dLect7 viewing in2d
Lect7 viewing in2d
BCET
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
Adri Jovin
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformationUdayan Gupta
 
2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)
Amit Kapoor
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
NANDINI SHARMA
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
Rathan Raj
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
SHIVANI SONI
 
Lecture 11 Perspective Projection
Lecture 11 Perspective ProjectionLecture 11 Perspective Projection
Lecture 11 Perspective Projection
guest0026f
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Oum Saokosal
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
Jargalsaikhan Alyeksandr
 

Viewers also liked (15)

2D viewing
2D viewing2D viewing
2D viewing
 
Lect 5 2d clipping
Lect 5 2d clippingLect 5 2d clipping
Lect 5 2d clipping
 
Windows to viewport transformation
Windows to viewport transformationWindows to viewport transformation
Windows to viewport transformation
 
Lect7 viewing in2d
Lect7 viewing in2dLect7 viewing in2d
Lect7 viewing in2d
 
Computer Graphics
Computer GraphicsComputer Graphics
Computer Graphics
 
Viewing transformation
Viewing transformationViewing transformation
Viewing transformation
 
2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)2 d transformations by amit kumar (maimt)
2 d transformations by amit kumar (maimt)
 
Clipping
ClippingClipping
Clipping
 
Notes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphicsNotes 2D-Transformation Unit 2 Computer graphics
Notes 2D-Transformation Unit 2 Computer graphics
 
Database Normalization
Database NormalizationDatabase Normalization
Database Normalization
 
3D transformation in computer graphics
3D transformation in computer graphics3D transformation in computer graphics
3D transformation in computer graphics
 
Lecture 11 Perspective Projection
Lecture 11 Perspective ProjectionLecture 11 Perspective Projection
Lecture 11 Perspective Projection
 
Databases: Normalisation
Databases: NormalisationDatabases: Normalisation
Databases: Normalisation
 
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NFDatabase Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
Database Normalization 1NF, 2NF, 3NF, BCNF, 4NF, 5NF
 
Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)Database design & Normalization (1NF, 2NF, 3NF)
Database design & Normalization (1NF, 2NF, 3NF)
 

Similar to 2 d viewing computer graphics

Computer Graphics - Windowing and Clipping
Computer Graphics - Windowing and ClippingComputer Graphics - Windowing and Clipping
Computer Graphics - Windowing and Clipping
Chandrakant Divate
 
ch4.pptx
ch4.pptxch4.pptx
ch4.pptx
OnkarTalekar4
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
Balamurugan M
 
Clipping
ClippingClipping
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...
Mani Kanth
 
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdfUNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
VivekKumar148171
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
ABDULSAMADKAZI
 
UNIT-III
UNIT-IIIUNIT-III
UNIT-III
VarthiniRamesh
 
affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphics
DrSUGANYADEVIK
 
Clipping CG ppt.pptx
Clipping CG ppt.pptxClipping CG ppt.pptx
Clipping CG ppt.pptx
AamirSheikh49
 
Unit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdfUnit-IV Windowing and Clipping.pdf
Unit-IV Windowing and Clipping.pdf
Amol Gaikwad
 
Clipping
ClippingClipping
Clipping
nehrurevathy
 
cg mod2.pdf
cg mod2.pdfcg mod2.pdf
cg mod2.pdf
ssuserf3db48
 
Bhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh window clipping slidshare
Bhavesh window clipping slidshare
Bhavesh Panchal
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
Shweta Shah
 
CS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxCS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptx
lara333479
 
Introduction to Real Time Rendering
Introduction to Real Time RenderingIntroduction to Real Time Rendering
Introduction to Real Time Rendering
Koray Hagen
 
Lec08112004.pdf
Lec08112004.pdfLec08112004.pdf
Lec08112004.pdf
LalithaPonnam
 
426 Lecture5: AR Registration
426 Lecture5: AR Registration426 Lecture5: AR Registration
426 Lecture5: AR Registration
Mark Billinghurst
 
Graphics_3D viewing
Graphics_3D viewingGraphics_3D viewing
Graphics_3D viewing
Rabin BK
 

Similar to 2 d viewing computer graphics (20)

Computer Graphics - Windowing and Clipping
Computer Graphics - Windowing and ClippingComputer Graphics - Windowing and Clipping
Computer Graphics - Windowing and Clipping
 
ch4.pptx
ch4.pptxch4.pptx
ch4.pptx
 
Unit 4 notes
Unit 4 notesUnit 4 notes
Unit 4 notes
 
Clipping
ClippingClipping
Clipping
 
Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...Window to viewport transformation&amp;matrix representation of homogeneous co...
Window to viewport transformation&amp;matrix representation of homogeneous co...
 
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdfUNIT_3-Two-Dimensional-Geometric-Transformations.pdf
UNIT_3-Two-Dimensional-Geometric-Transformations.pdf
 
99995327.ppt
99995327.ppt99995327.ppt
99995327.ppt
 
UNIT-III
UNIT-IIIUNIT-III
UNIT-III
 
affine transformation for computer graphics
affine transformation for computer graphicsaffine transformation for computer graphics
affine transformation for computer graphics
 
Clipping CG ppt.pptx
Clipping CG ppt.pptxClipping CG ppt.pptx
Clipping CG ppt.pptx
 
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
 
cg mod2.pdf
cg mod2.pdfcg mod2.pdf
cg mod2.pdf
 
Bhavesh window clipping slidshare
Bhavesh window clipping slidshareBhavesh window clipping slidshare
Bhavesh window clipping slidshare
 
Windowing clipping
Windowing   clippingWindowing   clipping
Windowing clipping
 
CS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptxCS401_M2_L6_Solid Area Scan Conversion.pptx
CS401_M2_L6_Solid Area Scan Conversion.pptx
 
Introduction to Real Time Rendering
Introduction to Real Time RenderingIntroduction to Real Time Rendering
Introduction to Real Time Rendering
 
Lec08112004.pdf
Lec08112004.pdfLec08112004.pdf
Lec08112004.pdf
 
426 Lecture5: AR Registration
426 Lecture5: AR Registration426 Lecture5: AR Registration
426 Lecture5: AR Registration
 
Graphics_3D viewing
Graphics_3D viewingGraphics_3D viewing
Graphics_3D viewing
 

Recently uploaded

ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
Jayaprasanna4
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
Divya Somashekar
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
Pratik Pawar
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
Amil Baba Dawood bangali
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
JoytuBarua2
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
Jayaprasanna4
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
Pipe Restoration Solutions
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Sreedhar Chowdam
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
karthi keyan
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
Kamal Acharya
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
Kamal Acharya
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
PrashantGoswami42
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
Kamal Acharya
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
ViniHema
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
fxintegritypublishin
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
Robbie Edward Sayers
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
Kamal Acharya
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
obonagu
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Dr.Costas Sachpazis
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
Kamal Acharya
 

Recently uploaded (20)

ethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.pptethical hacking-mobile hacking methods.ppt
ethical hacking-mobile hacking methods.ppt
 
block diagram and signal flow graph representation
block diagram and signal flow graph representationblock diagram and signal flow graph representation
block diagram and signal flow graph representation
 
weather web application report.pdf
weather web application report.pdfweather web application report.pdf
weather web application report.pdf
 
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
NO1 Uk best vashikaran specialist in delhi vashikaran baba near me online vas...
 
Planning Of Procurement o different goods and services
Planning Of Procurement o different goods and servicesPlanning Of Procurement o different goods and services
Planning Of Procurement o different goods and services
 
ethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.pptethical hacking in wireless-hacking1.ppt
ethical hacking in wireless-hacking1.ppt
 
The Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdfThe Benefits and Techniques of Trenchless Pipe Repair.pdf
The Benefits and Techniques of Trenchless Pipe Repair.pdf
 
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&BDesign and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
Design and Analysis of Algorithms-DP,Backtracking,Graphs,B&B
 
CME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional ElectiveCME397 Surface Engineering- Professional Elective
CME397 Surface Engineering- Professional Elective
 
Vaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdfVaccine management system project report documentation..pdf
Vaccine management system project report documentation..pdf
 
Courier management system project report.pdf
Courier management system project report.pdfCourier management system project report.pdf
Courier management system project report.pdf
 
Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.Quality defects in TMT Bars, Possible causes and Potential Solutions.
Quality defects in TMT Bars, Possible causes and Potential Solutions.
 
Final project report on grocery store management system..pdf
Final project report on grocery store management system..pdfFinal project report on grocery store management system..pdf
Final project report on grocery store management system..pdf
 
power quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptxpower quality voltage fluctuation UNIT - I.pptx
power quality voltage fluctuation UNIT - I.pptx
 
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdfHybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
Hybrid optimization of pumped hydro system and solar- Engr. Abdul-Azeez.pdf
 
HYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generationHYDROPOWER - Hydroelectric power generation
HYDROPOWER - Hydroelectric power generation
 
Automobile Management System Project Report.pdf
Automobile Management System Project Report.pdfAutomobile Management System Project Report.pdf
Automobile Management System Project Report.pdf
 
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
在线办理(ANU毕业证书)澳洲国立大学毕业证录取通知书一模一样
 
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
Sachpazis:Terzaghi Bearing Capacity Estimation in simple terms with Calculati...
 
Student information management system project report ii.pdf
Student information management system project report ii.pdfStudent information management system project report ii.pdf
Student information management system project report ii.pdf
 

2 d viewing computer graphics

  • 1. 2D Viewing Arambam Neelima Dept of CSE, NIT Nagaland
  • 2.
  • 3. Clipping • The technique for not showing the part of the picture in which one is not interested is called as clipping. • A graphics package allows a user to specify which part of a defined picture is to be displayed and where that part is to be placed on the display device
  • 4. • A view for a 2D picture is selected by specifying a region of the xy plane that contains the total picture or any part of it • select parts of Picture areas are then mapped onto specified areas of the device coordinates • 2D viewing transformations from world to device coordinates involve translation, rotation, and scaling operations, as well as procedures for deleting those parts of the picture that are outside the limits of a selected scene area
  • 5. Co-ordinate system • World Co-ordinate System: Right handed cartesian co-ordinate system in which we describe the co-ordinates of the picture to be displayed. • Device Co-ordinate System: Co-ordinate system corresponding to the device in which we want to display.
  • 6. Viewing transformation system • 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. • Window defines ‘What’ to be viewed and the viewport defines ‘Where’ it is to be displayed
  • 7. Window Object in World Co- ordinate system Object in Device co- ordinate system
  • 8. • Case I: If we change the position of the window keeping the viewport location constant then the different part of the object is displayed at the same position on the display device • Case II: If we change the location of the viewport but keep the window constant then the same part of the object is drawn at different place. • Changing the size of viewports, we can change the size and proportions of displayed objects; zoom in and zoom out effects
  • 9. Normalization Normalization: Specify coordinate values between 0 and1 • normalization and window to viewport transformations can be combined into one operation. • In this case, the viewport coordinates in the range from 0 to 1 so that the viewport is positioned within a unit square • Unit square containing the viewport is mapped to the outputdisplay device • normalization and clipping routines are applied before the viewport transformation
  • 10. • Object descriptions are transferred to this normalized space using a transformation that maintains the same relative placement of a point in the viewport as it had in the clipping window • Position (xw, yw) in the clipping window is mapped to position (xv, yv) in the associated viewport
  • 11. • To transform the world-coordinate point into the same relative position within the viewport, we require, • Solving these equations for xv and yv where
  • 12. • Window to viewport  Window-to-viewport transformation  Relative placement of object descriptions is maintained  Relative proportions of objects, on the other hand, are maintained only if the aspect ratio of viewport is same as that of clipping window i.e. sx = sy  Else, world objects will be stretched or contracted in either the x or y directions (or both) when displayed on the output device • Clipping window to normalized viewport  clipping routines can be applied using either the clipping window boundaries or the viewport boundaries  normalized coordinates are transformed into device coordinates  the unit square can be mapped onto the output device by translation and scaling
  • 13. Point Clipping • Given a clipping rectangle in standard position, we save a two-dimensional point P = (x, y) for display if • If any of these inequalities is not satisfied, the point is clipped i.e. not saved for display
  • 14. Line Clipping • A line-clipping algorithm processes each line in a scene to determine whether the entire line or any part of it is to be saved for display
  • 15. • Line Clipping • Need to compute intersection points of lines with clipping window • minimize intersection calculation for better algorithm • Test whether a line segment is completely inside the clipping window or completely outside • Completely inside – easy; both points are inside – P1P2 • Completely outside – difficult; both points outside?? – P3P4 • If not possible –Test whether any part of a line crosses the window interior
  • 16. COHEN SUTHERLAND LINE CLIPPING One of the earliest algorithms for fast line clipping • Processing time is reduced by performing more tests before proceeding to the intersection calculations • Every line endpoint in a picture is assigned a four-bit binary value – region code • Each bit position is used to indicate whether the point is inside or outside one of the clipping-window boundaries Bit 4 Bit 3 Bit 2 Bit 1 Bottom Right LeftTop Bit 1 is set to 1 when point lies to left of the window Bit 2 is set to 1 when point lies to right of the window Bit 3 is set to 1 when point lies below/bottom of window Bit 4 is set to 1 when point lies above the window
  • 17. • Bit values in a region code determined by comparing the • coordinate values (x, y) endpoints to the clipping boundaries • Bit 1 is set to 1 if x < xwmin • Bit 2 is set to 1 if x > xwmax • Bit 3 is set to 1 if y < ywmin • Bit 4 is set to 1 if y > ywmax • Calculate differences between endpoint coordinates and clipping boundaries. • Use the resultant sign bit of each difference calculation to set • the corresponding value in the region code.
  • 18. • For any given line, • If both endpoints have region code 0000 – completely inside • If both endpoints has a region-code value of 1 in at least one same bit position – completely outside the clipping rectangle, and we eliminate that line segment • Lines that cannot be identified as completely inside or completely outside are checked for intersections • As each clipping-window edge is processed, a section of the line is clipped, and remaining part of the line is checked against the other window borders • Eliminate sections until either the line is totally clipped or the remaining part of the line is inside the clipping window.
  • 19. • To determine a boundary intersections, use the slope intercept form of the line equation • For a line with endpoint coordinates (x0, y0) and (xend, yend), • For intersection point with a vertical clipping border line, ycoordinate is obtained with the calculation where the x value is set to either xwmin or xwmax • Similarly, for intersection with a horizontal border, the xcoordinate is calculated as with y set either to ywmin or to ywmax
  • 20. • Use Cohen Sutherland algorithm to clip the line P(70,20) and Q(100,10) against a window lower left hand corner (50,10) and upper right hand corner (80,40). (70,20) and (80, 16.667)