Clipping Polygons Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki

Slides:



Advertisements
Similar presentations
9.1 Si23_03 SI23 Introduction to Computer Graphics Lecture 9 – Clipping.
Advertisements

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.
Objectives Define Clipping Various clipping methods. Line clipping methods.
Java ThreadsGraphics Programming Graphics Programming: Windows, Viewports & Clipping.
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.
Computer Graphics, KKU. Lecture 81 Clipping on a Raster Display.
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)
Clipping Lines Lecture 7 Wed, Sep 10, The Graphics Pipeline From time to time we will discuss the graphics pipeline. The graphics pipeline is the.
Two-Dimensional Viewing Jehee Lee Seoul National University.
Computer Graphics Viewing.
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 2 1.
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 Computer Graphics Chapter 4 2D Viewing Algorithms.
Course Website: Computer Graphics 9: Clipping In 3D.
1 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Clipping.
Graphics Pipeline Clipping CMSC 435/634. Graphics Pipeline Object-order approach to rendering Sequence of operations – Vertex processing – Transforms.
2D transformations and homogeneous coordinates Dr Nicolas Holzschuch University of Cape Town Modified.
2-Dimension Viewing and Clipping
Rasterizing primitives: know where to draw the line Dr Nicolas Holzschuch University of Cape Town Modified.
Windowing and clipping
1 Introduction to Computer Graphics with WebGL Ed Angel Professor Emeritus of Computer Science Founding Director, Arts, Research, Technology and Science.
Defining complex objects Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki.
CS 480/680 Computer Graphics Shading in OpenGL Dr. Frederick C Harris, Jr. Fall 2013.
3D transformations Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki
CAP4730: Computational Structures in Computer Graphics
Windows, Viewports, and Clipping
1 Visiblity: Culling and Clipping Computer Graphics COMP 770 (236) Spring 2009 January 21 & 26: 2009.
© 97 N. Holzschuch 3D objects representation and data structure Dr Nicolas Holzschuch University of Cape Town
Projections and Perspectives Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki.
10/19/04© University of Wisconsin, CS559 Fall 2004 Last Time Clipping –Why we care –Sutherland-Hodgman –Cohen-Sutherland –Intuition for Liang-Barsky Homework.
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
Introduction to Computer Graphics Chapter 6 – 2D Viewing Pt 3 1.
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.
Lecture 13: Raster Graphics and Scan Conversion
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.
CS552: Computer Graphics Lecture 12: 3D Clipping.
CENG 538 Advanced Graphics and UIs
Computer Graphics Lecture 14 CLIPPING I Taqdees A. Siddiqi
Computer Graphics Clipping.
Introduction to Computer Graphics with WebGL
Computer Graphics CC416 Week 13 Clipping.
CS 551 / 645: Introductory Computer Graphics
Computer Graphics Shading in OpenGL
Concepts, Algorithms for line clipping
CSCE 441 Computer Graphics: Clipping Polygons Jinxiang Chai
Implementation I Ed Angel
Graphics Pipeline Clipping
Computer Graphics 9: Clipping In 3D
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.
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
Clipping Polygons Dr. Scott Schaefer.
Clipping Clipping Sutherland-Hodgman Clipping
3D transformations Dr Nicolas Holzschuch University of Cape Town
CS U540 Computer Graphics Prof. Harriet Fell Spring 2007
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 Polygons Dr Nicolas Holzschuch University of Cape Town Modified by Longin Jan Latecki Sep. 11, 2002

Map of the lecture Problems in clipping polygons Clipping polygons –against one edge of the window –against the whole window Clipping other shapes Accelerating the clipping

Clipping a polygon Different possible cases We have to fill the result of clipping

A polygon must be filled We have to fill the result: –must indentify the new edges –the result must be closed Window Polygon being clipped Resulting polygon

Several new polygons Clipping a polygon may result in several new polygons: Window Polygon being clipped Resulting polygons The data structure must provide for this

Clipping a polygon: algorithm Start by clipping against a window boundary Do each polygon edge in turn Clip each polygon edge against the boundary: –If leaving, connect to latest entering –If entering, connect to latest leaving

Polygon against boundary Outside

Polygon against boundary Outside Inside

Polygon against boundary

Connect

Polygon against boundary

Polygon against window Do each window boundary in turn For each window boundary, clip the polygon using previous algorithm The result is a closed polygon or several closed polygons These are fed to the next window boundary

Polygon against window First edge

Polygon against window Second edge

Polygon against window Third edge

Polygon against window Fourth edge

Clipping Polygons: conclusion A more complex algorithm Algorithmic complexity: 4 times the number of edges Easy to implement using standard languages

Other shapes (circles) Convert the shape to polygon, then clip the polygon –problem: too many edges on the polygon Clip the shape during rasterization –problem: rasterizing invisible parts –can be accelerated by eliminating parts that are trivially invisible

Accelerating clipping Clipping can be a costly step Optimization: –use extents and don’t clip parts that are: trivially invisible trivially visible

Extents Compute the x-extent and the y-extent of the shape: xminxmax ymax ymin

Trivial accept/reject Check the extent with the window: ACCEPT REJECT

Trivial accept/reject Spend some time doing a trivial test Gain more time by avoiding complex computations A common idea to many computer graphics algorithms