A.Aruna/Assistant Professor/SNSCE

Slides:



Advertisements
Similar presentations
มุมมองใน 2 มิติ (2-D Viewing)
Advertisements

Computer Graphics CLIPPING.
Objectives Define Clipping Various clipping methods. Line clipping methods.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
10/10/02 (c) 2002 University of Wisconsin, CS 559 Last Time Finished viewing: Now you know how to: –Define a region of space that you wish to view – the.
CHAPTER 12 Height Maps, Hidden Surface Removal, Clipping and Level of Detail Algorithms © 2008 Cengage Learning EMEA.
Dr. Scott Schaefer Clipping Lines. 2/94 Why Clip? We do not want to waste time drawing objects that are outside of viewing window (or clipping window)
Course Website: Computer Graphics 4: Viewing In 2D.
1 Clipping. 2 Transformation Sequence X Y Z X Y Z X Y Z X Y Z Object Coords. Eye Coords. Clip Coords. Normalized Device Coords. Screen Coords. Implementation:
Two-Dimensional Viewing Jehee Lee Seoul National University.
Computer Graphics : Clipping
Computer Graphics Viewing.
Viewing & Clipping In 2D. 2 of 44 Contents Windowing Concepts Clipping –Introduction –Brute Force –Cohen-Sutherland Clipping Algorithm Area Clipping –Sutherland-Hodgman.
CMPE 466 COMPUTER GRAPHICS Chapter 8 2D Viewing Instructor: D. Arifler Material based on - Computer Graphics with OpenGL ®, Fourth Edition by Donald Hearn,
2 D viewing Prepared by Elizabeth Isaac DCS, RSET.
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
CHAPTER 7 2D VIEWING CGMB214: Introduction to Computer Graphics.
University of British Columbia CPSC 314 Computer Graphics Jan-Apr 2005 Tamara Munzner Interpolation Clipping.
Informationsteknologi Thursday, November 22, 2007Computer Graphics - Class 111 Today’s class Clipping Parametric and point-normal form of lines Intersecting.
Vertices and Fragments I CS4395: Computer Graphics 1 Mohan Sridharan Based on slides created by Edward Angel.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Two Dimensional Viewing Dr. Eng. Farag Elnagahy
1 CSCE 441 Computer Graphics: Clipping Lines Jinxiang Chai.
Computer Graphics Clipping Cohen Sutherland Algorithm (Line) Cyrus-Back Algorithm (Line) Sutherland-Hodgeman Algorithm (Polygon) Cohen Sutherland Algorithm.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Clipping.
University College Dublin1 Clipping u Clipping is the removal of all objects or part of objects in a modelled scene that are outside the real-world window.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Implementation I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
2D Viewing. 2D viewing transformation is a mapping of world coordinate scene to device coordinates xw min xw max yw min yw max xv min xv max yv min yv.
Graphics Pipeline Clipping CMSC 435/634. Graphics Pipeline Object-order approach to rendering Sequence of operations – Vertex processing – Transforms.
1 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
2-Dimension Viewing and Clipping
Clipping Apart from clipping to the view volume, clipping is a basic operation in many other algorithms –Breaking space up into chunks –2D drawing and.
Windowing and clipping
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
Two-Dimensional Viewing
Clipping: Clipping is a process of dividing an object into visible and invisible positions and displaying the visible portion and discarding the invisible.
CS 325 Introduction to Computer Graphics 03 / 08 / 2010 Instructor: Michael Eckmann.
Two Dimensional Viewing
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
Graphics Graphics Korea University cgvr.korea.ac.kr 1 2D Viewing 고려대학교 컴퓨터 그래픽스 연구실.
CSE Real Time Rendering Week 9. Post Geometry Shaders Courtesy: E. Angel and D. Shreiner – Interactive Computer Graphics 6E © Addison-Wesley 2012.
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Windows, Viewports, and Clipping
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 1 1.
Unit – IV 2D Viewing. 2 of 30 Contents Windowing Concepts The viewing pipeline viewing coordinate reference frame, window to view-port coordinate transformation,
10/19/04© University of Wisconsin, CS559 Fall 2004 Last Time Clipping –Why we care –Sutherland-Hodgman –Cohen-Sutherland –Intuition for Liang-Barsky Homework.
EEL Introduction to Computer Graphics
Implementation of a Renderer Consider Programs are processd by the system line & polygon, outside the view volume Efficiently Understanding of the implementation.
1 Computer Graphics Clipping Fall FCC Line Clipping What happens when one or both endpoints of a line segment are not inside the specified drawing.
1Computer Graphics Implementation 1 Lecture 15 John Shearer Culture Lab – space 2
CS552: Computer Graphics Lecture 6: Viewing in 2D.
2D Viewing.
Clipping Primitives. Clipping line Clipping rectangle: – x min to x max – y min to y max A point (x,y) lies within a clip rectangle and thus displayed.
Graphics Graphics & Graphical Programming Lecture 23 - Viewing & Clipping.
Institute for Visualization and Perception Research 1 © Copyright 2000 Haim Levkowitz Raster graphics alg’s for drawing 2D primitives Points of view Application.
Clipping. Before clipping… After clipping… Point Clipping Display P = (x, y) if xw min
Perspective View Volume View Volume Far Near Window Far Near Window Center of Projection Center of Projection (a) Original Orientation (b) After Transformation.
Computer Graphics Viewing. 2 of 30 Viewing in 2D Window in world coordinates. 45  250  Viewport in Device coords 250 x 250 Pixels.
Lecture 9 From Vertices to Fragments. Objectives Introduce basic implementation strategies Clipping Rasterization hidden-surface removal.
Chapter 71 Computer Graphics - Chapter 7 From Vertices to Fragments Objectives are: How your program are processed by the system that you are using, Learning.
Clipping.
Two-Dimensional Viewing Hearn & Baker Chapter 6
Computer Graphic 2 D Viewing.
Computer Graphics CC416 Week 13 Clipping.
Transformations contd.
2D Viewing & Clipping 한신대 류승택
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
WINDOWING AND CLIPPING
WINDOWING AND CLIPPING
Two Dimensional Viewing and Clipping.
COMPUTER GRAPHICS Clipping
Presentation transcript:

A.Aruna/Assistant Professor/SNSCE 2D Viewing & Clipping 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Contents The viewing pipeline Viewing coordinate reference frame Window-to-viewport coordinate transformation Clipping operations Point clipping Line clipping 4/27/2017 A.Aruna/Assistant Professor/SNSCE

The viewing pipeline [1/5] window a world-coordinate area selected for display define what is to be viewed view port an area on a display device to 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/27/2017 A.Aruna/Assistant Professor/SNSCE

The viewing pipeline [2/5] viewing transformation the mapping of a part of a world-coordinate scene to device coordinates 2D viewing transformation = window-to-viewport, windowing transformation 4/27/2017 A.Aruna/Assistant Professor/SNSCE

The viewing pipeline [3/5] viewing-transformation in several steps construct the world-coordinate scene using modeling transformations transform descriptions in world coordinates to viewing coordinates map the viewing-coordinate description of the scene to normalized coordinates transfer to device coordinates 4/27/2017 A.Aruna/Assistant Professor/SNSCE

The viewing pipeline [4/5] viewing-transformation by changing the position of the viewport can view objects at different positions on the display area of an output device by varying the size of viewports can change the size and proportions of displayed objects zooming effects = panning effects 4/27/2017 A.Aruna/Assistant Professor/SNSCE

The viewing pipeline [5/5] viewport define within the unit square device-independent ⇒ separating the viewing & other transformations from specific output-device requirements the unit square is mapped to the display area for the particular output device in use at that time viewport clipping perform in normalized coordinates or in device coordinates to reduce computations by concatenating the various transformation matrices provide for specifying the world-coordinate window 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Viewing coordinate reference frame view up vector define the viewing yv direction unit vectors v=(vx, vy) and u=(ux, uy) for the viewing yv and xv axes The composite 2D transformation to convert world coordinates to viewing coordinates MWC,VC = R • T 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Window-to-viewport coordinate transformation transfer to the viewing reference frame choose the window extents in viewing coordinate select the viewport limits in normalized coordinate to maintain the same relative placement in the viewport as in the window 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Window-to-viewport coordinate transformation Relative proportions of objects sx=xvmax-xvmin/xwmax-xwmin, sy=yvmax-yvmin/ywmax-ywmin sx=sy : maintain sx≠sy : stretch or contract in either the x or y direction when displayed on the output device workstation transformation select a window area in normalized space and a viewport area in the coordinates of the display device 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Clipping operations clipping algorithm(simply clipping) identify those portions of picture that are either inside or outside of a specified region of space clip window the region against which an object is to clipped clipping application extracting part of a defined scene for viewing identifying visible surfaces in 3D views Antialiasing line segments or object boundaries creating objects using solid-modeling procedures displaying a multiwindow environment drawing & painting1111 operations that allow parts of a picture to be selected for copying,moving,erasing, or duplicating 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Clipping operations world-coordinate clipping remove those primitives outside the window from further consideration eliminating the processing necessary to transform those primitives to device space viewport clipping reduce calculations by allowing concatenation of viewing and geometric transformation matrices require that the transformation to device coordinates be performed for all objects, including those outside the window area 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Point clipping Assuming that the clip window is a rectangle in standard position P=(x, y) the edges of the clip window(xwmin, xwmax, ywmin, ywmax) can be either the world-coordinate window boundaries or viewport boundaries 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE \\ EXAMPLE: apply to scenes involving explosions or sea foam 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE 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 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Line clipping Checking the line endpoints ⇒ inside-outside test Line clipping Cohen-Sutherland line clipping Liang-Barsky line clipping Nicholl – Lee- Nicholl Line Clipping 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Line clipping Cohen-Sutherland line clipping one of the oldest and most popular line-clipping procedures speed up the processing of line segments by performing initial tests that reduce the number of intersections that must be calculated region code : four-digit binary code ⇒ bit 1:left, bit 2:right, bit 3:below, bit 4:above for languages in which bit manipulation is possible 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Line clipping region-code bit values determined calculate difference between endpoint coordinates and clipping boundaries use the resultant sign bit of each difference calculation to set the corresponding value in the region code bit 1 : the sign bit of x – xwmin bit 2 : the sign bit of xwmax – x bit 3 : the sign bit of y – ywmin bit 4 : the sign bit of ywmax – y 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Line clipping Determine which lines are completely inside the clip window and which line are clearly outside completely inside the clip window region code of 0000 for both endpoints trivially accept these lines clearly outside the clip window any line that a 1 in the same bit position in region code trivially reject these lines by using logical and operation with both region codes 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Line clipping check for intersection with the window boundaries using the slope-intercept form of the line equation x value Is set either to xwmin or to xwmax y value Is set either to ywmin or to ywmax 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Polygon Clipping Modify the line clipping Algorithm Processed with line segments- unconnected line segments Depends on the orientation of polygon 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Polygon Clipping 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Sutherland-Hodgeman Polygon Clipping Processing the polygon boundary as a whole against each window edge Processing all polygon vertices against each clip rectangle boundary in turn 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Sutherland-Hodgeman Polygon Clipping Pass each pair of adjacent polygon vertices to a window boundary clipper There are four cases: 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Sutherland-Hodgeman Polygon Clipping Intermediate output vertex list Once all vertices have been processed for one clip window boundary, it is generated. The output list of vertices is clipped against the next window boundary. It can be eliminated by a pipeline of clipping routine. Convex polygons are correctly clipped. If the clipped polygon is concave Split the concave polygon 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Sutherland-Hodgeman Polygon Clipping v3 v2 v1 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Weiler-Atherton Polygon Clipping Developed as a method for identifying visible surfaces It can be applied with arbitrary polygon-clipping region. Not always proceeding around polygon edges Sometimes follows the window boundaries For clockwise processing of polygon vertices For an outside-to-inside pair of vertices, follow the polygon boundary. For an inside-to-outside pair of vertices, follow the window boundary in clockwise direction. 4/27/2017 A.Aruna/Assistant Professor/SNSCE

Weiler-Atherton Polygon Clipping 4/27/2017 A.Aruna/Assistant Professor/SNSCE

A.Aruna/Assistant Professor/SNSCE Other Clipping Curve clipping Use bounding rectangle to test for overlap with a rectangular clip window. Text clipping All-or-none string-clipping All-or-none character-clipping Clip the components of individual characters 4/27/2017 A.Aruna/Assistant Professor/SNSCE