Clipping Computer Graphics Cohen Sutherland Algorithm (Line)

Slides:



Advertisements
Similar presentations
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Clipping Concepts, Algorithms for line clipping 1 of 16 Clipping - 10/16/12.
Advertisements

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.
3D Clipping & Viewing process
Objectives Define Clipping Various clipping methods. Line clipping methods.
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.
CS 551 / 645: Introductory Computer Graphics Clipping Lines and Polygons.
Computer Graphics, KKU. Lecture 81 Clipping on a Raster Display.
David Breen, William Regli and Maxim Peysakhov
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)
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.
Line Clipping Algorithms. A Cases for Clipping Lines E B H C G J I clip rectangle 2Prepared by Narendra V G CSE MIT.
Clipping CSE 403 Computer Graphics Cohen Sutherland Algorithm (Line)
CMPE 466 COMPUTER GRAPHICS Chapter 8 2D Viewing Instructor: D. Arifler Material based on - Computer Graphics with OpenGL ®, Fourth Edition by Donald Hearn,
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
Visibility culling – Clipping. The visibility problem What polygons are visible? There are few visible polygons. –Avoid redundant processing Three classes.
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.
CS 376 Introduction to Computer Graphics 02 / 12 / 2007 Instructor: Michael Eckmann.
Clipping: Clipping is a process of dividing an object into visible and invisible positions and displaying the visible portion and discarding the invisible.
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
CSE Real Time Rendering Week 9. Post Geometry Shaders Courtesy: E. Angel and D. Shreiner – Interactive Computer Graphics 6E © Addison-Wesley 2012.
Clipping Computer Graphics Cohen Sutherland Algorithm (Line)
Windows, Viewports, and Clipping
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
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 3 1.
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.
CS552: Computer Graphics Lecture 12: 3D Clipping.
Computer Graphics Implementation II.
Two-Dimensional Viewing Hearn & Baker Chapter 6
CENG 538 Advanced Graphics and UIs
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.
CS 551 / 645: Introductory Computer Graphics
Computer Graphics Shading in OpenGL
Concepts, Algorithms for line clipping
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
3D rezanje 3D Clipping view frustrum clipping planes clipped.
Concepts, algorithms for clipping
3D Clipping.
Implementation I Ed Angel
Graphics Pipeline Clipping
Computer Graphics : Viewing In 2D
CSCE 441 Computer Graphics: Clipping Lines Jinxiang Chai
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
CSCE 441 Computer Graphics: Clipping Lines Jinxiang Chai
Lecture 13 Clipping & Scan Conversion
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
Segment Clipping Simple algorithm. For each segment compute the intersection with the four sides of the rectangle, and then determine which sub-segment.
© University of Wisconsin, CS559 Fall 2004
3D rezanje 3D Clipping view frustrum clipping planes clipped.
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Clipping Clipping Sutherland-Hodgman Clipping
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Type to enter a caption. Computer Graphics Week 4 Lecture 2.
Clipping University of British Columbia CPSC 314 Computer Graphics
Implementation I Ed Angel Professor Emeritus of Computer Science
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
COMPUTER GRAPHICS Clipping
Presentation transcript:

Clipping Computer Graphics Cohen Sutherland Algorithm (Line) Cyrus-Back Algorithm (Line) Sutherland-Hodgeman Algorithm (Polygon) Cohen Sutherland Algorithm (3d)

Point Clipping For a point (x,y) to be inside the clip rectangle:

Point Clipping For a point (x,y) to be inside the clip rectangle:

Cases for clipping lines Line Clipping Cases for clipping lines

Cases for clipping lines Line Clipping Cases for clipping lines

Cases for clipping lines Line Clipping Cases for clipping lines

Cases for clipping lines Line Clipping Cases for clipping lines

Cases for clipping lines Line Clipping Cases for clipping lines

Cases for clipping lines Line Clipping Cases for clipping lines

Clipping Lines by Solving Simultaneous Equations Line Clipping Clipping Lines by Solving Simultaneous Equations

Cohen-Sutherland Algorithm The Cohen-Sutherland Line-Clipping Algorithm performs initial tests on a line to determine whether intersection calculations can be avoided. First, end-point pairs are checked for Trivial Acceptance. If the line cannot be trivially accepted, region checks are done for Trivial Rejection. If the line segment can be neither trivially accepted or rejected, it is divided into two segments at a clip edge, so that one segment can be trivially rejected. These three steps are performed iteratively until what remains can be trivially accepted or rejected.

Cohen-Sutherland Algorithm Region outcodes

Cohen-Sutherland Algorithm A line segment can be trivially accepted if the outcodes of both the endpoints are zero. A line segment can be trivially rejected if the logical AND of the outcodes of the endpoints is not zero. A key property of the outcode is that bits that are set in nonzero outcode correspond to edges crossed.

Cohen-Sutherland Algorithm An Example

Cohen-Sutherland Algorithm An Example

Cohen-Sutherland Algorithm An Example

Cohen-Sutherland Algorithm An Example

Parametric Line-Clipping (1) This fundamentally different (from Cohen-Sutherland algorithm) and generally more efficient algorithm was originally published by Cyrus and Beck. (2) Liang and Barsky later independently developed a more efficient algorithm that is especially fast in the special cases of upright 2D and 3D clipping regions.They also introduced more efficient trivial rejection tests for general clip regions.

The Cyrus-Back Algorithm

The Cyrus-Back Algorithm

The Cyrus-Back Algorithm PE = Potentially Entering PL = Potentially Leaving

The Cyrus-Back Algorithm Precalculate Ni and PEi for each edge for (each line segment to be clipped) { if (P1 == P0) line is degenerated, so clip as a point; else { tE = 0; tL = 1; for (each candidate intersection with a clip edge) { if (Ni • D != 0) { /* Ignore edges parallel to line */ calculate t; use sign of Ni • D to categorize as PE or PL; if (PE) tE = max(tE , t); if (PL) tL = min(tL , t); } } if (tE > tL) return NULL; else return P(tE) and P(tL) as true clip intersection;

Polygon Clipping Example

Polygon Clipping Example

Polygon Clipping Example

Sutherland-Hodgeman Algo. Clip Against Bottom Clipping Boundary Clip Against Left Clipping Boundary The Clipped Polygon Clip Against Top Clipping Boundary Clip Against Right Clipping Boundary Initial Condition

4 Cases of Polygon Clipping

Algorithm

3D Clipping Both the Cohen-Sutherland and Cyrus-Beck clipping algorithm readily extend to 3D. For Cohen-Sutherland algorithm use two extra-bit in outcode for incorporating z < zmin and z > zmax regions

Thank You