1/1/20001 Topic >>>> Scan Conversion CSE5280 - Computer Graphics.

Slides:



Advertisements
Similar presentations
Graphics Primitives: line
Advertisements

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
+ CPCS 391 Computer Graphics 1 Instructor: Dr. Sahar Shabanah Lecture 3.
Lecture 5 Rendering lines 1.Steps of line rendering 2.Scan-conversion for line segments 3.A1 tutorial CP411 Computer Graphics Fall 2007 Wilfrid Laurier.
Line Drawing Algorithms. Rasterization-Process of determining which pixels give the best approximation to a desired line on the screen. Scan Conversion-Digitizing.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
Computer Graphics CLIPPING.
Komputer Grafik 2 (AK045206) Scan Conversion 1/31 Scan Conversion.
Output Primitives Computer Graphics.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
Bresenham’s Midpoint Algorithm CS5600 Computer Graphics Rich Riesenfeld Spring 2006 Lecture Set 1.
Finite Mathematics & Its Applications, 10/e by Goldstein/Schneider/SiegelCopyright © 2010 Pearson Education, Inc. 1 of 71 Chapter 1 Linear Equations and.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 45 Computer Graphics Implementation I.
INTEGRALS 5. INTEGRALS We saw in Section 5.1 that a limit of the form arises when we compute an area.  We also saw that it arises when we try to find.
Line Drawing by Algorithm. Line Drawing Algorithms Line drawn as pixels Graphics system –Projects the endpoints to their pixel locations in the frame.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Scan Conversion CS123 1 of 44Scan Conversion - 10/14/2014.
Rasterization Foley, Ch: 3. Pixels are represented as disjoint circles centered on uniform grid Each (x,y) of the grid has a pixel Y X (1,1) (1,2) (0,0)
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Circle Drawing algo..
Chapter 5.1 Systems of linear inequalities in two variables.
Graphing Linear Inequalities
Segment Measure and Coordinate Graphing
Dr. Scott Schaefer Scan Conversion of Lines. 2/78 Displays – Cathode Ray Tube.
Scan Conversion. Also known as rasterization In our programs objects are represented symbolically –3D coordinates representing an object’s position –Attributes.
IT- 601: Computer Graphics Lecture-03 Scan Conversion
Dr. S.M. Malaek Assistant: M. Younesi
Jehee Lee Seoul National University
Graphics Primitives: line. Pixel Position
WHERE TO DRAW A LINE?? Line drawing is accomplished by calculating intermediate positions along the line path between specified end points. Precise definition.
Scan Conversion Line and Circle
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Clipping: Clipping is a process of dividing an object into visible and invisible positions and displaying the visible portion and discarding the invisible.
Equations of Lines Chapter 8 Sections
College of Computer and Information Science, Northeastern UniversityOctober 12, CS G140 Graduate Computer Graphics Prof. Harriet Fell Spring 2006.
Multiple Integration Copyright © Cengage Learning. All rights reserved.
Graphics Output Primitives
Linear Inequalities and Linear Programming Chapter 5 Dr.Hayk Melikyan Department of Mathematics and CS
CGMB214: Introduction to Computer Graphics
Computer Graphics Drawing Line. Lines and Polylines Convex: For every pair of points in the polygon, the line between them is fully contained in the polygon.
10/15/02 (c) 2002 University of Wisconsin, CS559 Who Am I? Prof Stephen Chenney These notes will be online after the lecture – in fact they’re online already.
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
Week 4 Functions and Graphs. Objectives At the end of this session, you will be able to: Define and compute slope of a line. Write the point-slope equation.
INTEGRALS We saw in Section 5.1 that a limit of the form arises when we compute an area. We also saw that it arises when we try to find the distance traveled.
5 INTEGRALS.
Barnett/Ziegler/Byleen Finite Mathematics 11e1 Learning Objectives for Section 5.1 Inequalities in Two Variables The student will be able to graph linear.
Scan Conversion.
1 The Coordinate Plane Just as points on a line can be identified with real numbers to form the coordinate line, points in a plane can be identified with.
Bresenham’s Line Algorithm
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
Line Drawing Algorithms 1. A line in Computer graphics is a portion of straight line that extends indefinitely in opposite direction. 2. It is defined.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Scan Conversion or Rasterization
Computer Graphics Drawing Line.
CSCE 441 Lecture 2: Scan Conversion of Lines
CS G140 Graduate Computer Graphics
Scan Conversion or Rasterization
Computer Graphics Implementation I.
Copyright © Cengage Learning. All rights reserved.
Scan Conversion of Lines
CSCE 441 Lecture 2: Scan Conversion of Lines
Scan Conversion of Circles
3D Rendering Pipeline Hidden Surface Removal 3D Primitives
Rasterizing Lines 1 Lecture 32 Mon, Nov 12, 2007.
Chapter 3 Graphics Output Primitives
Presentation transcript:

1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics

1/1/20002 Graphics Display Devices Frame Buffer – a region of memory sufficiently large to hold all of the pixel values for the display

1/1/20003 Graphics Display Devices - cont How each pixel value in the frame buffer is sent to the right place on the display surface

1/1/20004 Graphics Devices – cont Each pixel has a 2D address (x,y) For each address (x,y) there is a specific memory location that holds the value of the pixel (I.e. mem[136][252]) The scan controller sends the logical address (136, 252) to the frame buffer, which emits the value mem[136][252] The value mem[136][252] is converted to a corresponding intensity or color in the conversion circuit, and that intensity or color is sent to the proper physical position, (136, 252), on the display surface

1/1/20005 Scan Converting Lines Line Drawing Draw a line on a raster screen between 2 points What’s wrong with the statement of the problem? It does not say anything about which pts are allowed as end pts It does not give a clear meaning to “draw” It does not say what constitutes a “line” in the raster world It does not say how to measure the success of the proposed algorithm

1/1/20006 Scan Converting Lines - cont Problem Statement Given 2 points P and Q in the plane, both with integer coordinates, determine which pixels on a raster screen should be “on” in order to make a picture of a unit-width line segment starting at point P and ending at point Q

1/1/20007 Finding the next pixel Special Case: Horizontal Line: Draw pixel P and increment the x coordinate value by one to get the next pixel. Vertical Line: Draw the pixel P and increment the y coordinate value by one to get the next pixel Diagonal Line: Draw the pixel P and increment both the x and y coordinate values by one to get the next pixel What should we use in the general case?

1/1/20008 Vertical Distance Why can we use the vertical distance as a measure of which point is closer? Because vertical distance is proportional to the actual distance How do we show this? Congruent Triangles

1/1/20009 Vertical Distance – cont By similar triangles we can see that the true distances to the line (in blue) are directly proportional to the vertical distances to the line (in black) for each point. Therefore the point with the smaller vertical distance to the line is the closest to the line

1/1/ Strategy 1 – Incremental Algorithm The Basic Algorithm Find the equation of the line that connects the 2 points P and Q Starting with the leftmost point P, increment by 1 to calculate where A = slope, and B = y intercept Intensify the pixel at This computation selects the closest pixel, the pixel whose distance to the “true” line is smallest

1/1/ Strategy 1 – Incremental Algorithm The Incremental Algorithm Each iteration requires a floating-point multiplication therefore, modify If, then Thus, a unit change in x changes y by slope A, which is the slope of the line At each step, we make incremental calculations based on the preceding step to find the next y value

1/1/ Strategy 1 – Incremental Aglo

1/1/ Example Code

1/1/ Problem with the Incremental Algorithm Rounding integers takes time Real variables have limited precision, summing an inexact slope (A) repetitively introduces a cumulative error buildup Variables y and A must be a real or fractional binary because the slope is a fraction Special case needed for vertical lines

1/1/ Strategy 2 – Midpoint Line Algorithm Assume that the line’s slope is shallow and positive ( 0 < slope < 1); other slopes can be handled by suitable reflections about the principle axes Call the lower left endpoint and the upper right endpoint Assume that we have just selected the pixel P at Next, we must choose between the pixel to the right (pixel E), or one right and one up (pixel NE) Let Q be the intersection point of the line being scan- converted with the grid line

1/1/ Strategy 2 – Midpoint Line Algorithm

1/1/ Strategy 2 – Midpoint Line Algorithm The line passes between E and NE The point that is closer to the intersection point Q must be chosen Observe on which side of the line the midpoint M lies: E is closer to the line if the midpoint lies above the line (I.e. the line crosses the bottom half) NE is closer to the line if the midpoint lies below the line, I.e., the line crosses the top half The error, the vertical distance between the chosen pixel and the actual line is always <= ½ The algorithm chooses NE as the next pixel for the line shown Now, find a way to calculate on which side of the line the midpoint lies

1/1/ The Line The line equation as a function f(x): f(x) = A*x + B = dy/dx * x + B Line equation as an implicit function: F(x,y) = a * x + b * y + c = 0 for coefficients a, b, c where a, b != 0; from above, y *dx = dy*x + B*dx, so a = dy, b = -dx, c=B *dx, a>0 for y(0) < y(1) Properties (proof by the case analysis): when any point M is on the line when any point M is above the line when any point M is below the line Our decision will be based on the value of the function at the midpoint M at

1/1/ Decision Variable Decision Variable d: We only need the sign of to see where the line lies, and then pick the nearest pixel If d > 0 choose pixel NE If d < 0 choose pixel E If d = 0 choose either one consistently How to update d: On the basis of picking E or NE, figure out the location of the M for that pixel, and the corresponding value of d for the next grid line

1/1/ Example Code

1/1/ Scan Conversion Summary