Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:

Size: px
Start display at page:

Download "Output Primitives Lecture: 3. Lecture 3. Output Primitives. Assuming we have a raster display, a picture is completely specified by:"

Transcription

1 Lecture 3 Output Primitives Assuming we have a raster display, a picture is completely specified by: - A set of intensities for the pixel positions in the display. - A set of complex objects, such as trees and terrain or furniture and walls, positioned at specified coordinate locations within the scene. Shapes and colors of the objects can be described internally with pixel arrays or with sets of basic geometric structures, such as straight line segments and polygon color areas figure (4-1). Figure (4-1): Image is set of intensities of pixels or a set of complex objects The scene is then displayed either by: - Loading the pixel arrays into the frame buffer. - Scan converting the basic geometric-structure specifications into pixel patterns. Typically, graphics programming packages provide functions to describe a scene in terms of these basic geometric structures, referred to as output primitives, and to group sets of output primitives into more complex structures. Each output primitive is specified with input coordinate data and other information about the way that objects is to be displayed. Points, straight line segments, circles, other conic sections, quadric surfaces, spline curves and surfaces, polygon color areas, and character strings are the most geometric components of pictures. We begin our discussion of picture-generation procedures by examining device-level algorithms for displaying two dimensional output primitives. Dr. Ayman Elshenawy Elsefy Page 1

2 Point Point plotting is accomplished by converting a single coordinate position furnished by an application program into appropriate operations for the output device in use. - In CRT monitor, the electron beam is turned on to illuminate the screen phosphor at the selected location. - How the electron beam is positioned depends on the display technology. o A random-scan (vector) system stores point-plotting instructions in the display list, and coordinate values in these instructions are converted to deflection voltages that position the electron beam at the screen locations to be plotted during each refresh cycle. o For a black and white raster system, a point is plotted by setting the bit value corresponding to a specified screen position within the frame buffer to 1. Then, as the electron beam sweeps across each horizontal scan line, it plots a point. o For RGB Raster system, the frame buffer is loaded with the color codes for the intensities that are to be displayed at the screen pixel positions. Figure (4-2) shows how a point is plotted in CRT Display devices. Figure (4-2): a point is plotted in CRT Display devices. Line Digital devices display a straight line segment by plotting discrete points between the start point and the end point. Discrete coordinate positions along the line path are calculated from the equation of the line. Dr. Ayman Elshenawy Elsefy Page 2

3 For a raster video display, the line color (intensity) is then loaded into the frame buffer at the corresponding pixel coordinates. After reading from the frame buffer, the video controller then "plots" the screen pixels. Screen locations (coordinates) are referenced with integer values, so plotted positions may only approximate actual line positions between two specified endpoints. A computed line position of (10.48, 20.51) [Mathematical Point], for example, would be converted to pixel position (10, 21). Thus rounding of coordinate values to integer s causes lines to be displayed with a stair-step appearance, as represented in Fig 4-3. The characteristic stair-step shape of raster lines is particularly noticeable on systems with low resolution, and we can improve their appearance somewhat by displaying them on high-resolution systems. More effective techniques for smoothing raster lines are based on adjusting pixel intensities along the line paths. The pixel positions are referenced according to scan-line number and column number (pixel position across a scan line). This addressing scheme is illustrated in Fig Scan lines are numbered consecutively from 0, starting at the top of the screen; and pixel columns are numbered from 0, left to right across each scan line. Figure (4-3): Stair-step appearance Figure (4-4): Pixel positions referenced by scan line number and column number One of 2 N intensities or colors is associated with each pixel, where N is the number of bits per pixel. Gray-scale typically has one byte per pixel, for 2 8 = 256 intensities. Dr. Ayman Elshenawy Elsefy Page 3

4 Color often requires one byte per channel, with three color channels per pixel: red, green, and blue. Color data is stored in a frame buffer. This is sometimes called an image map or bitmap. To load a specified color into the frame buffer at a position corresponding to column x along scan line y, we will assume we have available a low-level procedure of the form setpixel(x, y, color): Sets the pixel at position (x, y) to the given color. We sometimes will also want to be able to retrieve the current frame buffer intensity setting for a specified location. We accomplish this with the low-level function getpixel(x, y) : Gets the color at the pixel at position (x, y). Line drawing algorithms The equation of straight line can be computed using the following equations, y = m x + b (1) m = y x = y 2 y 1 x 2 x 1 (2) And b = y 1 m x 1 (3) Figure (4-4): Line path between endpoint positions (x 1, y 1 ) and (x 2, y 2 ) With m representing the slope of the line and b as the y intercept. Given that the two endpoints of a line segment are specified at positions (x 1, y 1 ) and (x 2, y 2 ) as shown in Fig. 4-4, we can determine values for the slope m and y intercept b with the following calculations: 1. Brute Force Algorithm The starting point is the equation of a straight line: Dr. Ayman Elshenawy Elsefy Page 4

5 y = mx + c where m is the gradient of the line: m = y x = y from y to x from x to and c is its intercept of the y-axis c = y from m x from Assume that the endpoints of the line are known, For any value of x we can compute y. A for loop can be used to iterate through all the values of x between xfrom and xto and for each of these, the corresponding y value calculated. figure 4-5 Enumerating the values of x Disadvantage of brute force method a. Gaps started to be appeared The results of running such an algorithm look like Figure 4-5. Unfortunately, if we pick coordinates for the end points such that the line is steep (in fact when its gradient m is >1 the results look something like Figure: Dr. Ayman Elshenawy Elsefy Page 5

6 Figure 4-6. Brute force algorithm with steep gradient The solution to the gaps problem is to always use the most rapidly changing variable (x or y) as the index to the loop (Figure 31). i.e. When the gradient (m) >1 - use y as the control variable in the loop and make x the subject of the equation: X = (y c)/m Figure 4-7-Comparison of x & y values for different gradients b. It requires floating point There is a second problem with the brute force approach: It requires floating point arithmetic which is slow when compared with using integer only arithmetic. An approach which used solely integers would result in a much quicker algorithm. It can be solved by removing the effect of the floating points 2. Bresenham s Algorithm One such integer only algorithm is Bresenham s. Start by considering the simple case where 0 < m <1 Consider, as before, iterating the x values from left to right. If the pixel at (x i, y i ) has been plotted, then the next one MUST be either (x i+1, y i ) or (x i+1, y i+1 ). Why? - Because of the Dr. Ayman Elshenawy Elsefy Page 6

7 gradient - it can t go up more than one step in the y direction for one step in the x (m<1) and it can t go down at all (0<=m). How can we work out which pixel to plot? Figure 4-8. The basis of Bresenham s algorithm - By calculating the difference between the true mathematical value of y at x i+1 (we ll call that y real ) and the y values represented by the pixels. Δy 1 and Δy 0 present these distances and the decision on which pixel to plot can be made by following the following pseudo code To illustrate Bresenham s approach, we first consider the scan conversion process for lines with positive slope less than 1. Pixel positions along a line path are then determined by sampling at unit x intervals. Starting from the left endpoint (x 0, y 0 ) of a given line, we step to each successive column (x position) and plot the pixel whose scan-line y value is closest to the line path. Figure 4-7(a) demonstrates the K th step in this process. Assuming we have determined that the pixel at (x i, y i ) is to be displayed, we next need to decide which pixel to plot in column x i + 1,. Our choices are the pixels at positions (x i+1, y i ) and (x i+1, y i+1 ). At sampling position x i+1, we label vertical pixel separations from the mathematical line path as d 1, and d 2. They coordinate on the mathematical line at pixel column position x k+1 is calculated as : y real = m(x i+1 ) + c Dr. Ayman Elshenawy Elsefy Page 7

8 d 1 = y real y i = m(x i+1 ) + c y i d 2 = y i+1 y real = y i+1 m(x i+1 ) + c The difference between these two separations is d 1 d 2 = 2m(x i+1 ) 2y i + 2c 1 A decision parameter p k for the i th step in the line algorithm can be obtained by rearranging the above Eq. so that it involves only integer calculations. We accomplish this by substituting m = y/ x, where y and x are the vertical and horizontal separations of the endpoint positions, and defining: p k = x(d 1 d 2 ) = 2 yx i + 2 y 2 x y i + 2 x b x p i = x(d 1 d 2 ) = 2 yx i 2 x y i R where R = 2 y + 2 x (b 1) The sign of p i, is the same as the sign of d 1 d 2, since x > 0 for our example. Parameter R is constant and has the value 2 y + 2 x (b 1), which is independent of pixel position and will be eliminated in the recursive calculations for p i. If the pixel at y i is closer to the line path than the pixel at y i +1 (that is, d 1 < d 2 ), then decision parameter p i is negative. In that case, we plot the lower pixel; otherwise, we plot the upper pixel. Coordinate changes along the line occur in unit steps in either the x or y directions. Therefore, we can obtain the values of successive decision parameters using incremental integer calculations. At step k + 1, the decision parameter is evaluated from Eq. as p i+1 = 2 yx i+1 2 x y i+1 R Subtracting p i+1 p i p i+1 p i = 2 y(x i+1 x i ) 2 x(y i+1 y i ) But x i+1 = x i + 1 p i+1 = p i + 2 y 2 x(y i+1 y i ) where the term y i+1 y i is either 0 or 1, depending on the sign of parameter p i. This recursive calculation of decision parameters is performed at each integer x position, starting at the left coordinate endpoint of the line. The first parameter, p i is evaluated from at the starting pixel position (x 0, y 0 ) and with m evaluated as y x : Dr. Ayman Elshenawy Elsefy Page 8

9 p 0 = 2 y x We can summarize Bresenham s line drawing for a line with a positive slope less than 1 in the following listed steps. The constants 2 y and 2 y 2 x are calculated once for each line to be scan converted, so the arithmetic involves only integer addition and subtraction of these two constants. Bresenham's Line-Drawing Algorithm for m < 1 1. Input the two line endpoints and store the left endpoint in (x 0, y 0 ) 2. Load (x 0, y 0 ) into the frame buffer; that is, plot the first point. 3. Calculate constants Δx, Δy, 2Δy, and 2Δy 2Δx, and obtain the starting value for the decision parameter as p 0 = 2 y x 4. At each x k along the line, starting at k = 0, perform the following test: If p k < 0, the next point to plot is (x k+1, y k ) and p k+1 = p k + 2 y Otherwise, the next point to plot is (x k+1, y k+1 ) and p k+1 = p k + 2 y 2 x 5. Repeat step 4 Δx times. An implementation of Bresenham s line drawing for slopes in the range m < 1 is given in the following procedure. Endpoint pixel positions for the line are passed to this procedure, and pixels are plotted from the left endpoint to the right endpoint. #Include <device.h> void linebresenham (int xa, int ya, int xb, int yb) { int dx = abs ( xa - xb ), dy = abs (ya - yb); int p = 2 * dy - d x ; int twody = 2 * dy, twodydx = 2 * (dy - Ax); int x, y, xend: /* Determine which point to use a s start, which as end * / if (xa > xb ) { x = xb; Y = yb; xend = xa; } else{ x = xa; Y = ya; xend = xb; } setpixel (x, y); while (x < xend) { x++; if (p < 0) { p += twody; } else { y++; p+= twodydx; } setpixel ( x, y); Dr. Ayman Elshenawy Elsefy Page 9

10 } } 3. Digital Differential Analyzer (DDA) algorithm This algorithm samples the line at unit interval in one coordinate and determines the corresponding integer values nearest the line path for other coordinates. The equation of the line is = mx + c, m = y2 y1, For any interval x, the corresponding interval is given by y = m x Case 1: m < 1 x2 x1 The sampling is done using x axis, x = 1 and y = m then: x i+1 = x i + 1 Then calculate y = m y i+1 = y i + y = y i + m Case 1: m > 1 The sampling is done using y axis, y = 1 and x = 1/m then y i+1 = y i + 1 Then calculate x = 1/m Dr. Ayman Elshenawy Elsefy Page 10

11 Algorithm x i+1 = x i + x = x i + ( 1 m ) 1. START 2. Get the values of the starting and ending co-ordinates i.e., (x 1, y 1 ) and (x 2, y 2 ). 3. Find the value of slope m m = y = y 2 y 1 x x 2 x 1 4. If m 1 then Δx = 1,Δy = mδx x k + 1=x k + 1, y k + 1 = y k + m 5. If m 1 then Δy = 1, Δx = Δy/m x k + 1 = x k + 1/m, y k + 1 = y k STOP /**** Program to Draw a Line using DDA Algorithm ****/ #include <stdio.h> #include <dos.h> #include <graphics.h> void linedda(int, int, int, int); void main() { int x1, y1, xn, yn; int gd = DETECT, gm; initgraph(&gd, &gm, ""); printf("enter the starting coordinates of line: "); scanf("%d %d", &x1, &y1); printf("enter the ending coordinates of line: "); scanf("%d %d", &xn, &yn); linedda(x1, y1, xn, yn); getch(); } void linedda(int x1, int y1, int xn, int yn) { int dx, dy, m, i; m = (yn-y1)/(xn-x1); for (i=x1; i<=xn; i++) { if (m <= 1) { dx = 1; dy = m * dx; } else { dy = 1; dx = dy / m; } x1 = x1 + dx; y1 = y1 + dy; putpixel(x1, y1, RED); delay(20); } } Dr. Ayman Elshenawy Elsefy Page 11

12 Figure 4-8 Comments: 1. It is faster to calculate pixel position. 2. Due to propagation of round off errors due to successive addition the calculated pixel may shift among from the true line path. Sheet 3 1. Describe how a point can be represented in display device? 2. Define a graphical line and how it can be displayed on a specific display device? 3. Explain the Basic concept of drawing a line using the brute force algorithm? 4. What are the main disadvantages of the brute force algorithm and how can we solve it? 5. For the Bresenham's line drawing algorithm : a. Explain the basic concept of the Presenham algorithm? b. Write the Algorithm c. Write a c++ implementation for this algorithm. 6. For the DDA line drawing algorithm : a. Explain the basic concept. b. Write the Algorithm c. Write a c++ implementation for this algorithm. 7. Write a Bresenham's line algorithm for line where m 1. Digitize a line with end points (20, 10) and (30, 18). Dr. Ayman Elshenawy Elsefy Page 12

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete

Scan Conversion. CMP 477 Computer Graphics S. A. Arekete Scan Conversion CMP 477 Computer Graphics S. A. Areete What is Scan-Conversion? 2D or 3D objects in real world space are made up of graphic primitives such as points, lines, circles and filled polygons.

More information

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms Computer Graphics: Graphics Output Primitives Line Drawing Algorithms By: A. H. Abdul Hafez Abdul.hafez@hku.edu.tr, 1 Outlines 1. Basic concept of lines in OpenGL 2. Line Equation 3. DDA Algorithm 4. DDA

More information

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi

Output Primitives. Dr. S.M. Malaek. Assistant: M. Younesi Output Primitives Dr. S.M. Malaek Assistant: M. Younesi Output Primitives Output Primitives: Basic geometric structures (points, straight line segment, circles and other conic sections, quadric surfaces,

More information

Output Primitives Lecture: 4. Lecture 4

Output Primitives Lecture: 4. Lecture 4 Lecture 4 Circle Generating Algorithms Since the circle is a frequently used component in pictures and graphs, a procedure for generating either full circles or circular arcs is included in most graphics

More information

Overview of Computer Graphics

Overview of Computer Graphics Application of Computer Graphics UNIT- 1 Overview of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe outline form. Multi-window

More information

Chapter - 2: Geometry and Line Generations

Chapter - 2: Geometry and Line Generations Chapter - 2: Geometry and Line Generations In Computer graphics, various application ranges in different areas like entertainment to scientific image processing. In defining this all application mathematics

More information

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels

Department of Computer Sciences Graphics Fall 2003 (Lecture 2) Pixels Pixels Pixel: Intensity or color sample. Raster Image: Rectangular grid of pixels. Rasterization: Conversion of a primitive s geometric representation into A set of pixels. An intensity or color for each

More information

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

Digital Differential Analyzer Bresenhams Line Drawing Algorithm Bresenham s Line Generation The Bresenham algorithm is another incremental scan conversion algorithm. The big advantage of this algorithm is that, it uses only integer calculations. Difference Between

More information

Rasterization: Geometric Primitives

Rasterization: Geometric Primitives Rasterization: Geometric Primitives Outline Rasterizing lines Rasterizing polygons 1 Rasterization: What is it? How to go from real numbers of geometric primitives vertices to integer coordinates of pixels

More information

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives.

OpenGL Graphics System. 2D Graphics Primitives. Drawing 2D Graphics Primitives. 2D Graphics Primitives. Mathematical 2D Primitives. D Graphics Primitives Eye sees Displays - CRT/LCD Frame buffer - Addressable pixel array (D) Graphics processor s main function is to map application model (D) by projection on to D primitives: points,

More information

From Ver(ces to Fragments: Rasteriza(on

From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments: Rasteriza(on From Ver(ces to Fragments 3D vertices vertex shader rasterizer fragment shader final pixels 2D screen fragments l determine fragments to be covered l interpolate

More information

1 Introduction to Graphics

1 Introduction to Graphics 1 1.1 Raster Displays The screen is represented by a 2D array of locations called pixels. Zooming in on an image made up of pixels The convention in these notes will follow that of OpenGL, placing the

More information

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored.

From Vertices to Fragments: Rasterization. Reading Assignment: Chapter 7. Special memory where pixel colors are stored. From Vertices to Fragments: Rasterization Reading Assignment: Chapter 7 Frame Buffer Special memory where pixel colors are stored. System Bus CPU Main Memory Graphics Card -- Graphics Processing Unit (GPU)

More information

Points and lines. x x 1 + y 1. y = mx + b

Points and lines. x x 1 + y 1. y = mx + b Points and lines Point is the fundamental element of the picture representation. It is nothing but the position in a plan defined as either pairs or triplets of number depending on whether the data are

More information

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE CS 450: COMPUTER GRAPHICS REVIEW: DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE DRAWING PRIMITIVES: LEGACY VS. NEW Legacy: specify primitive in glbegin() glbegin(gl_points); glvertex3f(1,5,0);

More information

CS Rasterization. Junqiao Zhao 赵君峤

CS Rasterization. Junqiao Zhao 赵君峤 CS10101001 Rasterization Junqiao Zhao 赵君峤 Department of Computer Science and Technology College of Electronics and Information Engineering Tongji University Vector Graphics Algebraic equations describe

More information

Computer Graphics: Line Drawing Algorithms

Computer Graphics: Line Drawing Algorithms Computer Graphics: Line Drawing Algorithms 1 Graphics hardware The problem scan conversion Considerations Line equations Scan converting algorithms A very simple solution The DDA algorithm, Bresenham algorithm

More information

Rasterization, or What is glbegin(gl_lines) really doing?

Rasterization, or What is glbegin(gl_lines) really doing? Rasterization, or What is glbegin(gl_lines) really doing? Course web page: http://goo.gl/eb3aa February 23, 2012 Lecture 4 Outline Rasterizing lines DDA/parametric algorithm Midpoint/Bresenham s algorithm

More information

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling

Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling Downloaded from :www.comp.dit.ie/bmacnamee/materials/graphics/006- Contents In today s lecture we ll have a loo at:

More information

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu

CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines. Emmanuel Agu CS 4731: Computer Graphics Lecture 21: Raster Graphics: Drawing Lines Emmanuel Agu 2D Graphics Pipeline Clipping Object World Coordinates Applying world window Object subset window to viewport mapping

More information

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics

Announcements. Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class. Computer Graphics Announcements Midterms graded back at the end of class Help session on Assignment 3 for last ~20 minutes of class 1 Scan Conversion Overview of Rendering Scan Conversion Drawing Lines Drawing Polygons

More information

Computer Graphics Lecture Notes

Computer Graphics Lecture Notes Computer Graphics Lecture Notes UNIT- Overview of Computer Graphics. Application of Computer Graphics Computer-Aided Design for engineering and architectural systems etc. Objects maybe displayed in a wireframe

More information

MET71 COMPUTER AIDED DESIGN

MET71 COMPUTER AIDED DESIGN UNIT - II BRESENHAM S ALGORITHM BRESENHAM S LINE ALGORITHM Bresenham s algorithm enables the selection of optimum raster locations to represent a straight line. In this algorithm either pixels along X

More information

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines COMP30019 Graphics and Interaction Scan Converting Polygons and Lines Department of Computer Science and Software Engineering The Lecture outline Introduction Scan conversion Scan-line algorithm Edge coherence

More information

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization.

Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática. Chap. 2 Rasterization. Tópicos de Computação Gráfica Topics in Computer Graphics 10509: Doutoramento em Engenharia Informática Chap. 2 Rasterization Rasterization Outline : Raster display technology. Basic concepts: pixel, resolution,

More information

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005

Renderer Implementation: Basics and Clipping. Overview. Preliminaries. David Carr Virtual Environments, Fundamentals Spring 2005 INSTITUTIONEN FÖR SYSTEMTEKNIK LULEÅ TEKNISKA UNIVERSITET Renderer Implementation: Basics and Clipping David Carr Virtual Environments, Fundamentals Spring 2005 Feb-28-05 SMM009, Basics and Clipping 1

More information

UNIT 2 GRAPHIC PRIMITIVES

UNIT 2 GRAPHIC PRIMITIVES UNIT 2 GRAPHIC PRIMITIVES Structure Page Nos. 2.1 Introduction 46 2.2 Objectives 46 2.3 Points and Lines 46 2.4 Line Generation Algorithms 48 2.4.1 DDA Algorithm 49 2.4.2 Bresenhams Line Generation Algorithm

More information

CSCI 4620/8626. Coordinate Reference Frames

CSCI 4620/8626. Coordinate Reference Frames CSCI 4620/8626 Computer Graphics Graphics Output Primitives Last update: 2014-02-03 Coordinate Reference Frames To describe a picture, the world-coordinate reference frame (2D or 3D) must be selected.

More information

Scan Converting Lines

Scan Converting Lines Scan Conversion 1 Scan Converting Lines Line Drawing Draw a line on a raster screen between two points What s wrong with the statement of the problem? it doesn t say anything about which points are allowed

More information

GRAPHICS OUTPUT PRIMITIVES

GRAPHICS OUTPUT PRIMITIVES CHAPTER 3 GRAPHICS OUTPUT PRIMITIVES LINE DRAWING ALGORITHMS DDA Line Algorithm Bresenham Line Algorithm Midpoint Circle Algorithm Midpoint Ellipse Algorithm CG - Chapter-3 LINE DRAWING Line drawing is

More information

Scan Conversion. Drawing Lines Drawing Circles

Scan Conversion. Drawing Lines Drawing Circles Scan Conversion Drawing Lines Drawing Circles 1 How to Draw This? 2 Start From Simple How to draw a line: y(x) = mx + b? 3 Scan Conversion, a.k.a. Rasterization Ideal Picture Raster Representation Scan

More information

Chapter 8: Implementation- Clipping and Rasterization

Chapter 8: Implementation- Clipping and Rasterization Chapter 8: Implementation- Clipping and Rasterization Clipping Fundamentals Cohen-Sutherland Parametric Polygons Circles and Curves Text Basic Concepts: The purpose of clipping is to remove objects or

More information

Line Drawing Week 6, Lecture 9

Line Drawing Week 6, Lecture 9 CS 536 Computer Graphics Line Drawing Week 6, Lecture 9 David Breen, William Regli and axim Peysakhov Department of Computer Science Drexel University Outline Line drawing Digital differential analyzer

More information

MODULE - 4. e-pg Pathshala

MODULE - 4. e-pg Pathshala e-pg Pathshala MODULE - 4 Subject : Computer Science Paper: Computer Graphics and Visualization Module: Midpoint Circle Drawing Procedure Module No: CS/CGV/4 Quadrant 1 e-text Before going into the Midpoint

More information

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques

Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques Introduction to Computer Graphics (CS602) Lecture 05 Line Drawing Techniques 5.1 Line A line, or straight line, is, roughly speaking, an (infinitely) thin, (infinitely) long, straight geometrical object,

More information

Raster Scan Displays. Framebuffer (Black and White)

Raster Scan Displays. Framebuffer (Black and White) Raster Scan Displays Beam of electrons deflected onto a phosphor coated screen Phosphors emit light when excited by the electrons Phosphor brightness decays -- need to refresh the display Phosphors make

More information

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics

About the Tutorial. Audience. Prerequisites. Copyright & Disclaimer. Computer Graphics r About the Tutorial To display a picture of any size on a computer screen is a difficult process. Computer graphics are used to simplify this process. Various algorithms and techniques are used to generate

More information

CS 450: COMPUTER GRAPHICS RASTERIZING LINES SPRING 2016 DR. MICHAEL J. REALE

CS 450: COMPUTER GRAPHICS RASTERIZING LINES SPRING 2016 DR. MICHAEL J. REALE CS 45: COMPUTER GRAPHICS RASTERIZING LINES SPRING 6 DR. MICHAEL J. REALE OBJECT-ORDER RENDERING We going to start on how we will perform object-order rendering Object-order rendering Go through each OBJECT

More information

Graphics (Output) Primitives. Chapters 3 & 4

Graphics (Output) Primitives. Chapters 3 & 4 Graphics (Output) Primitives Chapters 3 & 4 Graphic Output and Input Pipeline Scan conversion converts primitives such as lines, circles, etc. into pixel values geometric description a finite scene area

More information

Display Technologies: CRTs Raster Displays

Display Technologies: CRTs Raster Displays Rasterization Display Technologies: CRTs Raster Displays Raster: A rectangular array of points or dots Pixel: One dot or picture element of the raster Scanline: A row of pixels Rasterize: find the set

More information

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14

Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 14 Scan Converting Lines, Circles and Ellipses Hello everybody, welcome again

More information

CS2401 Computer Graphics

CS2401 Computer Graphics UNIT I - 2D PRIMITIVES Output primitives Line, Circle and Ellipse drawing algorithms - Attributes of output primitives Two dimensional Geometric transformation - Two dimensional viewing Line, Polygon,

More information

Topic #1: Rasterization (Scan Conversion)

Topic #1: Rasterization (Scan Conversion) Topic #1: Rasterization (Scan Conversion) We will generally model objects with geometric primitives points, lines, and polygons For display, we need to convert them to pixels for points it s obvious but

More information

Efficient Plotting Algorithm

Efficient Plotting Algorithm Efficient Plotting Algorithm Sushant Ipte 1, Riddhi Agarwal 1, Murtuza Barodawala 1, Ravindra Gupta 1, Prof. Shiburaj Pappu 1 Computer Department, Rizvi College of Engineering, Mumbai, Maharashtra, India

More information

Computer Graphics D Graphics Algorithms

Computer Graphics D Graphics Algorithms ! Computer Graphics 2014! 2. 2D Graphics Algorithms Hongxin Zhang State Key Lab of CAD&CG, Zhejiang University 2014-09-26! Screen Nikon D40 Sensors 3 Rasterization - The task of displaying a world modeled

More information

CPSC / Scan Conversion

CPSC / Scan Conversion CPSC 599.64 / 601.64 Computer Screens: Raster Displays pixel rasters (usually) square pixels in rectangular raster evenly cover the image problem no such things such as lines, circles, etc. scan conversion

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

Computer Graphics. - Rasterization - Philipp Slusallek

Computer Graphics. - Rasterization - Philipp Slusallek Computer Graphics - Rasterization - Philipp Slusallek Rasterization Definition Given some geometry (point, 2D line, circle, triangle, polygon, ), specify which pixels of a raster display each primitive

More information

Painter s HSR Algorithm

Painter s HSR Algorithm Painter s HSR Algorithm Render polygons farthest to nearest Similar to painter layers oil paint Viewer sees B behind A Render B then A Depth Sort Requires sorting polygons (based on depth) O(n log n) complexity

More information

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing

Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Computer Graphics (CS 543) Lecture 10: Rasterization and Antialiasing Prof Emmanuel Agu Computer Science Dept. Worcester Polytechnic Institute (WPI) Recall: Rasterization Rasterization (scan conversion)

More information

Einführung in Visual Computing

Einführung in Visual Computing Einführung in Visual Computing 186.822 Rasterization Werner Purgathofer Rasterization in the Rendering Pipeline scene objects in object space transformed vertices in clip space scene in normalized device

More information

UNIT I INTRODUCTION. Survey of Computer Graphics

UNIT I INTRODUCTION. Survey of Computer Graphics CS6504 COMPUTER GRAPHICS UNIT I INTRODUCTION Survey of computer graphics, Overview of graphics systems Video display devices, Raster scan systems, Random scan systems, Graphics monitors and Workstations,

More information

EF432. Introduction to spagetti and meatballs

EF432. Introduction to spagetti and meatballs EF432 Introduction to spagetti and meatballs CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~karan/courses/418/fall2015 Instructor: Karan

More information

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk

Computer Graphics. Lecture 2. Doç. Dr. Mehmet Gokturk Computer Graphics Lecture 2 Doç. Dr. Mehmet Gokturk Mathematical Foundations l Hearn and Baker (A1 A4) appendix gives good review l Some of the mathematical tools l Trigonometry l Vector spaces l Points,

More information

Unit 2 Output Primitives and their Attributes

Unit 2 Output Primitives and their Attributes Unit 2 Output Primitives and their Attributes Shapes and colors of the objects can be described internally with pixel arrays or with sets of basic geometric structures, such as straight line segments and

More information

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Chapter 4 Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes Line Attributes Fill-Area Attributes Scan-Line

More information

Rendering. A simple X program to illustrate rendering

Rendering. A simple X program to illustrate rendering Rendering A simple X program to illustrate rendering The programs in this directory provide a simple x based application for us to develop some graphics routines. Please notice the following: All points

More information

CS 543: Computer Graphics. Rasterization

CS 543: Computer Graphics. Rasterization CS 543: Computer Graphics Rasterization Robert W. Lindeman Associate Professor Interactive Media & Game Development Department of Computer Science Worcester Polytechnic Institute gogo@wpi.edu (with lots

More information

Chapter 3. Sukhwinder Singh

Chapter 3. Sukhwinder Singh Chapter 3 Sukhwinder Singh PIXEL ADDRESSING AND OBJECT GEOMETRY Object descriptions are given in a world reference frame, chosen to suit a particular application, and input world coordinates are ultimately

More information

COMP371 COMPUTER GRAPHICS

COMP371 COMPUTER GRAPHICS COMP371 COMPUTER GRAPHICS LECTURE 14 RASTERIZATION 1 Lecture Overview Review of last class Line Scan conversion Polygon Scan conversion Antialiasing 2 Rasterization The raster display is a matrix of picture

More information

CS6504 & Computer Graphics Unit I Page 1

CS6504 & Computer Graphics Unit I Page 1 Introduction Computer contains two components. Computer hardware Computer hardware contains the graphics workstations, graphic input devices and graphic output devices. Computer Software Computer software

More information

Pipeline implementation II

Pipeline implementation II Pipeline implementation II Overview Line Drawing Algorithms DDA Bresenham Filling polygons Antialiasing Rasterization Rasterization (scan conversion) Determine which pixels that are inside primitive specified

More information

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1

Computer Graphics. Attributes of Graphics Primitives. Somsak Walairacht, Computer Engineering, KMITL 1 Computer Graphics Chapter 4 Attributes of Graphics Primitives Somsak Walairacht, Computer Engineering, KMITL 1 Outline OpenGL State Variables Point Attributes t Line Attributes Fill-Area Attributes Scan-Line

More information

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal

Raster Displays and Scan Conversion. Computer Graphics, CSCD18 Fall 2008 Instructor: Leonid Sigal Raster Displays and Scan Conversion Computer Graphics, CSCD18 Fall 28 Instructor: Leonid Sigal Rater Displays Screen is represented by 2D array of locations called piels y Rater Displays Screen is represented

More information

Line Drawing. Foundations of Computer Graphics Torsten Möller

Line Drawing. Foundations of Computer Graphics Torsten Möller Line Drawing Foundations of Computer Graphics Torsten Möller Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Interaction Color Texture/ Realism Reading Angel

More information

(Refer Slide Time: 9:36)

(Refer Slide Time: 9:36) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture - 13 Scan Converting Lines, Circles and Ellipses Hello and welcome to the lecture

More information

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico

Implementation III. Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Implementation III Ed Angel Professor of Computer Science, Electrical and Computer Engineering, and Media Arts University of New Mexico Objectives Survey Line Drawing Algorithms - DDA - Bresenham 2 Rasterization

More information

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc.

Chapter 1. Linear Equations and Straight Lines. 2 of 71. Copyright 2014, 2010, 2007 Pearson Education, Inc. Chapter 1 Linear Equations and Straight Lines 2 of 71 Outline 1.1 Coordinate Systems and Graphs 1.4 The Slope of a Straight Line 1.3 The Intersection Point of a Pair of Lines 1.2 Linear Inequalities 1.5

More information

CS 130. Scan Conversion. Raster Graphics

CS 130. Scan Conversion. Raster Graphics CS 130 Scan Conversion Raster Graphics 2 1 Image Formation Computer graphics forms images, generally two dimensional, using processes analogous to physical imaging systems like: - Cameras - Human visual

More information

Topics. From vertices to fragments

Topics. From vertices to fragments Topics From vertices to fragments From Vertices to Fragments Assign a color to every pixel Pass every object through the system Required tasks: Modeling Geometric processing Rasterization Fragment processing

More information

SNAP Centre Workshop. Graphing Lines

SNAP Centre Workshop. Graphing Lines SNAP Centre Workshop Graphing Lines 45 Graphing a Line Using Test Values A simple way to linear equation involves finding test values, plotting the points on a coordinate plane, and connecting the points.

More information

An Improved Algorithm for Scan-converting a Line

An Improved Algorithm for Scan-converting a Line An Improved Algorithm for Scan-converting a Line *Md. Hasanul Kabir 1, Md. Imrul Hassan 2, Abdullah Azfar 1 1 Department of Computer Science & Information Technology (CIT) 2 Department of Electrical &

More information

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers

UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers UNIVERSITY OF NEBRASKA AT OMAHA Computer Science 4620/8626 Computer Graphics Spring 2014 Homework Set 1 Suggested Answers 1. How long would it take to load an 800 by 600 frame buffer with 16 bits per pixel

More information

RASTERIZING POLYGONS IN IMAGE SPACE

RASTERIZING POLYGONS IN IMAGE SPACE On-Line Computer Graphics Notes RASTERIZING POLYGONS IN IMAGE SPACE Kenneth I. Joy Visualization and Graphics Research Group Department of Computer Science University of California, Davis A fundamental

More information

Scan Converting Circles

Scan Converting Circles Scan Conversion Algorithms CS 460 Computer Graphics Professor Richard Eckert Circles Ellipses and Other 2-D Curves Text February 16, 2004 Scan Converting Circles Given: Center: (h,k) Radius: r Equation:

More information

Realtime 3D Computer Graphics Virtual Reality

Realtime 3D Computer Graphics Virtual Reality Realtime 3D Computer Graphics Virtual Reality From Vertices to Fragments Overview Overall goal recapitulation: Input: World description, e.g., set of vertices and states for objects, attributes, camera,

More information

Computer Graphics. Lecture 3 Graphics Output Primitives. Somsak Walairacht, Computer Engineering, KMITL

Computer Graphics. Lecture 3 Graphics Output Primitives. Somsak Walairacht, Computer Engineering, KMITL Computer Graphics Lecture 3 Graphics Output Primitives Somsa Walairacht, Computer Engineering, KMITL Outline Line Drawing Algorithms Circle-, Ellipse-Generating Algorithms Fill-Area Primitives Polgon Fill

More information

UNIT 2 Scan Conversion Techniques and Image Representation Unit-02/Lecture-01

UNIT 2 Scan Conversion Techniques and Image Representation Unit-02/Lecture-01 UNIT 2 Scan Conversion Techniques and Image Representation Unit-02/Lecture-01 Scan Conversion [RGPV/DEC-2008(10)] Scan conversion or scan rate converting is a technique for changing the vertical / horizontal

More information

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller

Line Drawing. Introduction to Computer Graphics Torsten Möller / Mike Phillips. Machiraju/Zhang/Möller Line Drawing Introduction to Computer Graphics Torsten Möller / Mike Phillips Rendering Pipeline Hardware Modelling Transform Visibility Illumination + Shading Perception, Color Interaction Texture/ Realism

More information

1.1 Survey of Computer graphics Computer graphics is the pictorial representation of information using a computer program.

1.1 Survey of Computer graphics Computer graphics is the pictorial representation of information using a computer program. UNIT I INTRODUCTION Survey of computer graphics, Overview of graphics systems Video display devices, Raster scan systems, Random scan systems, Graphics monitors and Workstations, Input devices, Hard copy

More information

Chapter 3: Graphics Output Primitives. OpenGL Line Functions. OpenGL Point Functions. Line Drawing Algorithms

Chapter 3: Graphics Output Primitives. OpenGL Line Functions. OpenGL Point Functions. Line Drawing Algorithms Chater : Grahics Outut Primitives Primitives: functions in grahics acage that we use to describe icture element Points and straight lines are the simlest rimitives Some acages include circles, conic sections,

More information

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1

2D Image Synthesis. 2D image synthesis. Raster graphics systems. Modeling transformation. Vectorization. u x u y 0. o x o y 1 General scheme of a 2D CG application 2D Image Synthesis Balázs Csébfalvi modeling image synthesis Virtual world model world defined in a 2D plane Department of Control Engineering and Information Technology

More information

Computer Graphics. Chapter 3 Computer Graphics Software

Computer Graphics. Chapter 3 Computer Graphics Software Computer Graphics Chapter 3 Computer Graphics Software Outline Graphics Software Packages Introduction to OpenGL Example Program 2 3 Graphics Software Software packages General Programming Graphics Packages

More information

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU FROM VERTICES TO FRAGMENTS Lecture 5 Comp3080 Computer Graphics HKBU OBJECTIVES Introduce basic implementation strategies Clipping Scan conversion OCTOBER 9, 2011 2 OVERVIEW At end of the geometric pipeline,

More information

Computer Graphics Lecture 5

Computer Graphics Lecture 5 1 / 25 Computer Graphics Lecture 5 Dr. Marc Eduard Frîncu West University of Timisoara Mar 27th 2012 2 / 25 Outline 1 Graphical Primitives Drawing Surfaces 2 Assignment 3 Recap 3 / 25 Graphical Primitives

More information

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK

CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY CS2401 COMPUTER GRAPHICS QUESTION BANK CHETTINAD COLLEGE OF ENGINEERING & TECHNOLOGY DEPARTMENT OF COMPUTER SCIENCE AND ENGINEERING CS2401 COMPUTER GRAPHICS QUESTION BANK PART A UNIT I-2D PRIMITIVES 1. Define Computer graphics. 2. Define refresh

More information

Shading Techniques Denbigh Starkey

Shading Techniques Denbigh Starkey Shading Techniques Denbigh Starkey 1. Summary of shading techniques 2 2. Lambert (flat) shading 3 3. Smooth shading and vertex normals 4 4. Gouraud shading 6 5. Phong shading 8 6. Why do Gouraud and Phong

More information

(Refer Slide Time: 00:03:51)

(Refer Slide Time: 00:03:51) Computer Graphics Prof. Sukhendu Das Dept. of Computer Science and Engineering Indian Institute of Technology, Madras Lecture 17 Scan Converting Lines, Circles and Ellipses Hello and welcome everybody

More information

R asterisation. Part I: Simple Lines. Affine transformation. Transform Render. Rasterisation Line Rasterisation 2/16

R asterisation. Part I: Simple Lines. Affine transformation. Transform Render. Rasterisation Line Rasterisation 2/16 ECM2410:GraphicsandAnimation R asterisation Part I: Simple Lines Rasterisation 1/16 Rendering a scene User space Device space Affine transformation Compose Transform Render Com pose from primitives (lines,

More information

Solution Notes. COMP 151: Terms Test

Solution Notes. COMP 151: Terms Test Family Name:.............................. Other Names:............................. ID Number:............................... Signature.................................. Solution Notes COMP 151: Terms

More information

1. DDA Algorithm(Digital Differential Analyzer)

1. DDA Algorithm(Digital Differential Analyzer) Basic concepts in line drawing: We say these computers have vector graphics capability (the line is a vector). The process is turning on pixels for a line segment is called vector generation and algorithm

More information

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA)

Rasterization. Rasterization (scan conversion) Digital Differential Analyzer (DDA) Rasterizing a line. Digital Differential Analyzer (DDA) CSCI 420 Computer Graphics Lecture 14 Rasterization Jernej Barbic University of Southern California Scan Conversion Antialiasing [Angel Ch. 6] Rasterization (scan conversion) Final step in pipeline: rasterization

More information

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves

0. Introduction: What is Computer Graphics? 1. Basics of scan conversion (line drawing) 2. Representing 2D curves CSC 418/2504: Computer Graphics Course web site (includes course information sheet): http://www.dgp.toronto.edu/~elf Instructor: Eugene Fiume Office: BA 5266 Phone: 416 978 5472 (not a reliable way) Email:

More information

UNIT -8 IMPLEMENTATION

UNIT -8 IMPLEMENTATION UNIT -8 IMPLEMENTATION 1. Discuss the Bresenham s rasterization algorithm. How is it advantageous when compared to other existing methods? Describe. (Jun2012) 10M Ans: Consider drawing a line on a raster

More information

Revision Topic 11: Straight Line Graphs

Revision Topic 11: Straight Line Graphs Revision Topic : Straight Line Graphs The simplest way to draw a straight line graph is to produce a table of values. Example: Draw the lines y = x and y = 6 x. Table of values for y = x x y - - - - =

More information

A Mathematical Overview of Bresenham Algorithms in the Determination of Active Pixel Positions

A Mathematical Overview of Bresenham Algorithms in the Determination of Active Pixel Positions A Mathematical Overview of Bresenham Algorithms in the Determination of Active Pixel Positions Makanjuola Daniel * Institute of Postgraduate Research and Studies, Cyprus International University, Nicosia,

More information

Intro. To Graphing Linear Equations

Intro. To Graphing Linear Equations Intro. To Graphing Linear Equations The Coordinate Plane A. The coordinate plane has 4 quadrants. B. Each point in the coordinate plain has an x-coordinate (the abscissa) and a y-coordinate (the ordinate).

More information

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2012 Lecture 5 September 13, 2012

CS 4300 Computer Graphics. Prof. Harriet Fell Fall 2012 Lecture 5 September 13, 2012 CS 4300 Computer Graphics Prof. Harriet Fell Fall 2012 Lecture 5 September 13, 2012 1 Today s Topics Vectors review Shirley et al. 2.4 Rasters Shirley et al. 3.0-3.2.1 Rasterizing Lines Shirley et al.

More information

CS335 Fall 2007 Graphics and Multimedia. 2D Drawings: Lines

CS335 Fall 2007 Graphics and Multimedia. 2D Drawings: Lines CS335 Fall 007 Grahics and Multimedia D Drawings: Lines Primitive Drawing Oerations Digital Concets of Drawing in Raster Arras PIXEL is a single arra element at x, - No smaller drawing unit exists Px,

More information

CS452/552; EE465/505. Clipping & Scan Conversion

CS452/552; EE465/505. Clipping & Scan Conversion CS452/552; EE465/505 Clipping & Scan Conversion 3-31 15 Outline! From Geometry to Pixels: Overview Clipping (continued) Scan conversion Read: Angel, Chapter 8, 8.1-8.9 Project#1 due: this week Lab4 due:

More information