Objectives Define Clipping Various clipping methods. Line clipping methods.

Slides:



Advertisements
Similar presentations
CGPage: 1 We can define a window as a rectangular region of the world coordinate space, and the viewport as a rectangular region of the device coordinate.
Advertisements

มุมมองใน 2 มิติ (2-D Viewing)
Computer Graphics 4: Viewing In 2D
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Clipping Concepts, Algorithms for line clipping 1 of 16 Clipping - 10/16/12.
Computer Graphics Inf4/MSc 1 Computer Graphics Lecture 7 Scanline algorithm and polygon clipping Taku Komura.
Rezanje črt in poligonov. World window & viewport window viewport screen window world window.
I N T R O D U C T I O N T O C O M P U T E R G R A P H I C S Andries van Dam September 30, D Clipping 1/14 Clipping (pages , )
Computer Graphics CLIPPING.
Line clipping: Line clipping algorithm is method of eliminate lines of outside area of the object,so outside of object viewing is Removed. Typically, any.
Course Website: Computer Graphics 4: Viewing In 2D.
Computer Graphics : Clipping
Computer Graphics Viewing.
Clipping CSE 403 Computer Graphics Cohen Sutherland Algorithm (Line)
Viewing & Clipping In 2D. 2 of 44 Contents Windowing Concepts Clipping –Introduction –Brute Force –Cohen-Sutherland Clipping Algorithm Area Clipping –Sutherland-Hodgman.
CGPage: 1 東吳資訊科學 江清水 The process of clipping decides which part, if any, of a primitive lies inside the window. The algorithms used for line clipping can.
CMPE 466 COMPUTER GRAPHICS Chapter 8 2D Viewing Instructor: D. Arifler Material based on - Computer Graphics with OpenGL ®, Fourth Edition by Donald Hearn,
2D Viewing and Projection
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.
1 Computer Graphics Chapter 4 2D Viewing Algorithms.
CS 376 Introduction to Computer Graphics 02 / 26 / 2007 Instructor: Michael Eckmann.
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.
1 Angel: Interactive Computer Graphics 4E © Addison-Wesley 2005 Implementation I Ed Angel Professor of Computer Science, Electrical and Computer Engineering,
Graphics Pipeline Clipping CMSC 435/634. Graphics Pipeline Object-order approach to rendering Sequence of operations – Vertex processing – Transforms.
2-Dimension Viewing and Clipping
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.
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
Clipping Computer Graphics Cohen Sutherland Algorithm (Line)
Windows, Viewports, and Clipping
Unit – IV 2D Viewing. 2 of 30 Contents Windowing Concepts The viewing pipeline viewing coordinate reference frame, window to view-port coordinate transformation,
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.
Computer Graphics Lecture 20 Fasih ur Rehman. Last Class Clipping – What is clipping – Why we do clipping – How clipping is done.
1Computer Graphics Implementation 1 Lecture 15 John Shearer Culture Lab – space 2
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.
A.Aruna/Assistant Professor/SNSCE
Clipping. Before clipping… After clipping… Point Clipping Display P = (x, y) if xw min
Computer Graphics Viewing. 2 of 30 Viewing in 2D Window in world coordinates. 45  250  Viewport in Device coords 250 x 250 Pixels.
Clipping.
Computer Graphics Lecture 14 CLIPPING I Taqdees A. Siddiqi
Computer Graphic 2 D Viewing.
Computer Graphics Clipping.
Introduction to Computer Graphics with WebGL
Computer Graphics CC416 Week 13 Clipping.
Transformations contd.
Computer Graphics Shading in OpenGL
Concepts, Algorithms for line clipping
2D Viewing & Clipping 한신대 류승택
Concepts, algorithms for clipping
Implementation I Ed Angel
Graphics Pipeline Clipping
WINDOWING AND CLIPPING
Computer Graphics : Viewing In 2D
Clipping Computer Graphics Cohen Sutherland Algorithm (Line)
CSCE 441 Computer Graphics: Clipping Lines Jinxiang Chai
CSCE 441 Computer Graphics: Clipping Lines Jinxiang Chai
WINDOWING AND CLIPPING
Two Dimensional Viewing and Clipping.
Segment Clipping Simple algorithm. For each segment compute the intersection with the four sides of the rectangle, and then determine which sub-segment.
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Clipping Clipping Sutherland-Hodgman Clipping
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Computer Graphics Viewing. 2 of 30 Viewing in 2D Window in world coordinates. 45  250  Viewport in Device coords 250 x 250 Pixels.
Implementation I Ed Angel Professor Emeritus of Computer Science
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Presentation transcript:

Objectives Define Clipping Various clipping methods. Line clipping methods

Clipping Any procedure that identifies those portions of a picture that are either inside or outside of a specified region

Point clipping Line clipping Area clipping or polygon clipping Curve clipping Text clipping

Point clipping In a rectanguar clip window save a point P = (x, y) for display if Xw min ≤ x ≤ xw max yw min ≤ y ≤ yw max. P(x,y)‏ xwminxwmax ywmin ywmax

Inside/Outside Test

Line Clipping Check whether the line is completely outside or inside the window boundary. Then perform inside outside test. Parametric eqn of a line with endpoints (x1,y1) and (x2,y2) is x= x1 + u (x2-x1)‏ y= y1 + u (y2-y1)‏ x1,y1 x2,y2

Line Clipping Window (a) Before Clipping (b) After Clipping

Cohen Sutherland Line Clipping (1968)‏ Before Clipping

After Clipping

Basic Idea –Encode the line endpoints –Successively divide the line segments so that they are completely contained in the window or completely lies outside window –Division occurs at the boundary of window Sutherland and Cohen 2D Clipping Algorithm

Region Code Setting Calculate the difference between endpoint coordinates and clipping boundaries. Use the resultant sign bit of each difference calculation to set corresponding region.

Bit 1sign bit of x-xw min Bit 2sign bit of xw max -x Bit 3sign bit of y-yw min Bit 4sign bit of yw max -y ywmax ywmin xwminxwmax left right below above

Bit 1- left Bit 2- right Bit 3- below Bit 4 - Above left right below above

Cohen-Sutherland Line Clipping

P1,P P P P P P P Bit 1- left Bit 2- right Bit 3- below Bit 4 - Above

After setting the region code determine whether the lines are –Completely inside the clip window. –Completely outside the clip window. –Intersecting with the window boundaries.

Completely Inside –Region code 0000 for both the endpoints. –Accept the line Completely outside –Lines have 1 in the same bit position. –Reject the line.

Method to test for total clipping Perform logical AND operation with the region code. If the result is not 0000 line is completely outside the clipping region. Lines that are not completely outside or inside a clip window are checked for intersection with the window boundary.

P1 P2 P1’ P2’ P2’’

Steps Lines may or may not cross the window interior. Start from an outside end point and check with the clipping boundary to determine how much of the line can be discarded. The remaining part of the line is checked against other boundaries & continue until either the line is totally discard or a section is found inside the window. Check line end points against clipping boundaries in the order –Left, Right, Bottom, top

Check P1 against left, right & bottom boundary. Find intersection point P1’ with bottom boundary and discard line section from P1 to P1’. Line reduced to P1’ P2. P1 P2 P1’ P2’ P2’’

Check P2 against the boundaries. P2 to the left of the window. Intersection point P2’ is calculated. P2’ above the window. Final intersection calculation leads to p2’’. Line from P1’ to P2’’ s saved P1 P2 P1’ P2’ P2’’

Intersection points with a boundary is calculated using slope intercept form Intersections with a vertical boundary: y=y1+m(x-x1) (x is either xmin or xmax)‏ Intersections with a horizontal boundary: x=x1+(y-y1)/m (y is either ymin or ymax)‏ Continue until a trivial accept or a trivial reject.