Scan Conversion of Line Segments. What is Scan conversion? Final step of rasterization (the process of taking geometric shapes and converting them into.

Slides:



Advertisements
Similar presentations
Graphics Primitives: line
Advertisements

CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1 Emmanuel Agu.
Section 3-1 to 3-2, 3-5 Drawing Lines Some of the material in these slides may have been adapted from university of Virginia, MIT, and Åbo Akademi University.
Computer Graphics 4: Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling By:Kanwarjeet Singh.
1 King ABDUL AZIZ University Faculty Of Computing and Information Technology CS 454 Computer graphics Drawing Elementary Figures Dr. Eng. Farag Elnagahy.
+ 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.
Scan Conversion Algorithms
Scan conversion of Line , circle & ellipse
Line Drawing Algorithms. Rasterization-Process of determining which pixels give the best approximation to a desired line on the screen. Scan Conversion-Digitizing.
Larry F. Hodges (modified by Amos Johnson) 1 Design of Line, Circle & Ellipse Algorithms.
OUTPUT PRIMITIVES Screen vs. World coordinate systems ● Objects positions are specified in a Cartesian coordinate system called World Coordinate.
CS 352: Computer Graphics Chapter 7: The Rendering Pipeline.
Raster conversion algorithms for line and circle
Output Primitives Computer Graphics.
Implementation Dr. Amy Zhang. Reading 2  Hill, Chapters  Hill, Chapter 10.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics May 3, 2007.
University of Missouri at Columbia 2D Scan-line Conversion University of Missouri at Columbia.
Course Website: Computer Graphics 5: Line Drawing Algorithms.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Scan Conversion CS123 1 of 44Scan Conversion - 10/14/2014.
Dr. Scott Schaefer Scan Conversion of Lines. 2/78 Displays – Cathode Ray Tube.
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
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
CS 325 Introduction to Computer Graphics 02 / 01 / 2010 Instructor: Michael Eckmann.
Introduction Computer Graphics & Its application Types of computer graphics Graphic display : random Scan & Raster Scan display Frame buffer and video.
Line Drawing and Generalization. Outline  overview  line drawing  circle drawing  curve drawing.
CGMB214: Introduction to Computer Graphics
 A line segment in a scene is defined by the coordinate positions of the line end-points x y (2, 2) (7, 5)
Computer Graphics Chapter 6 Andreas Savva. 2 Interactive Graphics Graphics provides one of the most natural means of communicating with a computer. Interactive.
Image Synthesis Rabie A. Ramadan, PhD 7. 2 Image Rasterization.
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.
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
In the name of God Computer Graphics. Today Introduction Sampling Graphic Output Primitives 1.Line 2.Circle 3.Curve 4.polygon.
Scan Conversion.
Lecture 13: Raster Graphics and Scan Conversion
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Write Bresenham’s algorithm for generation of line also indicate which raster locations would be chosen by Bresenham’s algorithm when scan converting.
Computer Graphics Inf4/MSc Computer Graphics Lecture 4 Line & Circle Drawing.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Rasterization CENG 477 Introduction to Computer Graphics Slides from Steve Marschner, CS4620, 2008 Cornell University.
Computer Graphics : output primitives.. 2 of 32 T1 – pp. 103–123, 137–145, 147–150, 164–171 Points and LinesPoints Line Drawing AlgorithmsLine Mid–Point.
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.
OUTPUT PRIMITIVES CEng 477 Computer Graphics METU, 2004.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Primitive graphic objects
Line Drawing Algorithms
Scan Conversion or Rasterization
CSCE 441 Lecture 2: Scan Conversion of Lines
CENG 477 Introduction to Computer Graphics
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Scan Conversion or Rasterization
Chapter Three Part I Output Primitives CS 380.
Scan Conversion of Lines
Computer Graphics 5: Line Drawing Algorithms
Computer Graphics 5: Line Drawing Algorithms
CSCE 441 Lecture 2: Scan Conversion of Lines
2D Scan-line Conversion
Introduction to Computer Graphics
Rasterization and Antialiasing
Computer Graphics 5: Line Drawing Algorithms
Rasterization and Antialiasing
Chapter 3 Graphics Output Primitives
Presentation transcript:

Scan Conversion of Line Segments

What is Scan conversion? Final step of rasterization (the process of taking geometric shapes and converting them into array of pixels stored in the frame buffer to be displayed ) Take place after clipping accurs. All graphics package do this at end of rendering pipeline Take triangles and maps them to pixels on the screen Also take into account other properties like lighting and shading,but we will focus on first on algorithm for line scan conversion.

Design criteria of straight lines What is the key issues of drawing a line ? Find the addressable pixels which most closely approximate this line. Straight line should appear straight. Line should start and end accurately matching end points with connecting lines. Lines should have constant brightness. Lines should be drawn as rapidly as possible.

. Problem Others create problems: Stair casing Aliasing Quality of the line depend on the location of the pixels and their brightness.

Direct solution to draw a line Y=mx+b, where (0,b) is the y intercept and m is the slope Go from x0 to x1: calculate round (y) from the equation Take an example b=1(starting point (0,1)) and m =3/5 Then x=1,y=2= round(8/5) x=2,y=2= round(11/5) x=3,y=3= round(14/5) x=4,y=3= round(17/5) x=5,y=4= round(20/5)

.

Direct solution to draw a line The line we draw must be straight. Why when we see line in the screen we always see it straight? Because we see a line in a high resolution graphic monitor and that monitor may have a thousands pixels. Another problem how fast we can draw the line ?

Why we use round ?

Direct solution to draw a line Why the round function is important? Because there is no addressable pixels available at any arbitrary floating number so you will use the next highest number and next lowest number.

Why is this undesired ? Operators like ‘*’ and ‘/’ are expensive. Round function needed. Can get gap in the line ( if the slope >1). Another example : Y=10.x+2 x1=1, y1=12; X2=2,y2=22.

DDA Algorithm 13 Digital Differential Analyzer Incremental algorithm DDA was a mechanical device for numerical solution of differential equations. Based on y =(y1-y0)/(x1-x0) x+ b Assume x1> x0 and dx > dy (Can easily be modifeid for the other cases ) dx=x1-x0; dy=y1-y0; m=dy/dx; y=y0;

. The algorithm For (x=x0 to x1) Draw_point(x,round(y)); Y=y+m; End for

. Problem There are still two costly functions one is the round operation and the second is the floating point addition. How can we get rid of these? If we can eliminate the round function and replace the floating addition by integer,the algorithm will be several times faster. DDA is not the most efficient one.

. We assume that we are drawing a line from the left to the right,the slope is less than one. There are 8 octants, we solve the algorithm in the first one.

Bresenham’s Algorithm Also called Midpoint Line Algorithm. Incremental algorithm (assume first octant). It is commonly used to draw lines on a computer screen, as it uses only integer addition, subtraction and bit shifting, all of which are very cheap operations in standard computer architectures. It is one of the earliest algorithms developed in the field of computer graphics. A minor extension to the original algorithm also deals with drawing circles.

. Given the choice of the current pixel,which one do we choose next :E or NE ? Equation: Y= (dy/dx)*x+B Rewrite As : F(x,y)=a*x+b*y+c=0 Gives :f(x,y)=dy*x-dx*y+B*dx=0 => a=dy, b=-dx, c=B*dx

. The equation of the line is F(x,y)=dy*x-dx*y+B*dx=0 If f(x,y)>0 if the point below the line If f(x,y)<0 if the point above the line

. If you take a point which is exactly on the line and substitute it in the equation the value of f(x,y) will be equal to zero. IF you substitute a value of a point which is on the top or the bottom of the line, then you will get the value of f(x,y) not equal to zero.

Hidden Surface Removal 21 Object-space approach: use pairwise testing between polygons (objects) partially obscuringcan draw independently

Painter’s Algorithm 22 Also known as a priority fill, is one of the simplest solutions to the visibility problem in 3D computer graphics. When projecting a 3D scene onto a 2D plane, it is necessary at some point to decide which polygons are visible, and which are hidden.