UNIT -8 IMPLEMENTATION

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

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

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

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

Line Drawing Week 6, Lecture 9

Rasterization: Geometric Primitives

Chapter 8: Implementation- Clipping and Rasterization

Scan Conversion. Drawing Lines Drawing Circles

(Refer Slide Time: 00:03:51)

Chapter - 2: Geometry and Line Generations

Computer Graphics: Graphics Output Primitives Line Drawing Algorithms

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

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

Clipping Points Consider a clip window which is rectangular in shape. P(x, y) is a point to be displayed.

From Ver(ces to Fragments: Rasteriza(on

In today s lecture we ll have a look at: A simple technique The mid-point circle algorithm

FROM VERTICES TO FRAGMENTS. Lecture 5 Comp3080 Computer Graphics HKBU

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

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

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

Clipping and Scan Conversion

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

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

Section Graphs and Lines

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

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

Computer Graphics D Graphics Algorithms

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

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

PESIT Bangalore South Campus Hosur road, 1km before Electronic City, Bengaluru -100 Department of Computer Science

A New Line Drawing Algorithm Based on Sample Rate Conversion

COMP371 COMPUTER GRAPHICS

Realtime 3D Computer Graphics Virtual Reality

Rendering. A simple X program to illustrate rendering

RASTERIZING POLYGONS IN IMAGE SPACE

MODULE - 4. e-pg Pathshala

Line Drawing. Foundations of Computer Graphics Torsten Möller

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

Pipeline implementation II

From 3D World to 2D Screen. Hendrik Speleers

CPSC / Scan Conversion

Lab Manual. Computer Graphics. T.E. Computer. (Sem VI)

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

Painter s HSR Algorithm

1 Introduction to Graphics

Clipping Lines. Dr. Scott Schaefer

CSCI 4620/8626. Computer Graphics Clipping Algorithms (Chapter 8-5 )

Last class. A vertex (w x, w y, w z, w) - clipping is in the - windowing and viewport normalized view volume if: - scan conversion/ rasterization

(Refer Slide Time: 9:36)

Incremental Form. Idea. More efficient if we look at d k, the value of the decision variable at x = k

Graphics (Output) Primitives. Chapters 3 & 4

The Rectangular Coordinate System and Equations of Lines. College Algebra

Institutionen för systemteknik

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

EF432. Introduction to spagetti and meatballs

Computer Graphics and GPGPU Programming

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

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

CSCI 4620/8626. Coordinate Reference Frames

OUTPUT PRIMITIVES. CEng 477 Introduction to Computer Graphics METU, 2007

Einführung in Visual Computing

Prof. Feng Liu. Fall /25/2018

Digital Differential Analyzer Bresenhams Line Drawing Algorithm

Review for Mastery Using Graphs and Tables to Solve Linear Systems

SNAP Centre Workshop. Graphing Lines

Display Technologies: CRTs Raster Displays

CS 543: Computer Graphics. Rasterization

QUADRATIC AND CUBIC GRAPHS

UNIT 2 GRAPHIC PRIMITIVES

Fall CSCI 420: Computer Graphics. 7.1 Rasterization. Hao Li.

SE Mock Online Test 1-CG

Intro. To Graphing Linear Equations

ax + by = 0. x = c. y = d.

CSCI 420 Computer Graphics Lecture 14. Rasterization. Scan Conversion Antialiasing [Angel Ch. 6] Jernej Barbic University of Southern California

Part 3: 2D Transformation

GRAPHICS OUTPUT PRIMITIVES

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

Computer Graphics D Graphics Algorithms

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

Rasterization. CS 4620 Lecture Kavita Bala w/ prior instructor Steve Marschner. Cornell CS4620 Fall 2015 Lecture 16

From Vertices To Fragments-1

CS 130. Scan Conversion. Raster Graphics

2D rendering takes a photo of the 2D scene with a virtual camera that selects an axis aligned rectangle from the scene. The photograph is placed into

Topic #1: Rasterization (Scan Conversion)

Computer Graphics. The Two-Dimensional Viewing. Somsak Walairacht, Computer Engineering, KMITL

Overview of Computer Graphics

Rasterization, Depth Sorting and Culling

Output Primitives Lecture: 4. Lecture 4

CS602 Midterm Subjective Solved with Reference By WELL WISHER (Aqua Leo)

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

Lecture 6 of 41. Scan Conversion 1 of 2: Midpoint Algorithm for Lines and Ellipses

COMP30019 Graphics and Interaction Scan Converting Polygons and Lines

Functions. Name. Use an XY Coordinate Pegboard to graph each line. Make a table of ordered pairs for each line. y = x + 5 x y.

Topics. From vertices to fragments

Pipeline and Rasterization. COMP770 Fall 2011

Rasterization. CS4620 Lecture 13

CS Rasterization. Junqiao Zhao 赵君峤

Rasterization. CS4620/5620: Lecture 12. Announcements. Turn in HW 1. PPA 1 out. Friday lecture. History of graphics PPA 1 in 4621.

Scan Converting Lines

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

Transcription:

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 grid where we restrict the allowable slopes of the line to the range. If we further restrict the line-drawing routine so that it always increments x as it plots, it becomes clear that, having plotted a point at (x,y), the routine has a severely limited range of options as to where it may put the next point on the line: It may plot the point (x+1,y), or: It may plot the point (x+1,y+1). So, working in the first positive octant of the plane, line drawing becomes a matter of deciding between two possibilities at each step. We can draw a diagram of the situation which the plotting program finds itself in having plotted (x,y). In plotting (x,y) the line drawing routine will, in general, be making a compromise between what it would like to draw and what the resolution of the screen actually allows it to draw. Usually the plotted point (x,y) will be in error, the actual, mathematical point on the line will not be addressable on the pixel grid. So we associate an error,, with each y ordinate, the real value of y should be. This error will range from -0.5 to just under +0.5. In moving from x to x+1 we increase the value of the true (mathematical) y-ordinate by an amount equal to the slope of the line, m. We will choose to plot (x+1,y) if the difference between this new value and y is less than 0.5.

Otherwise we will plot (x+1,y+1). It should be clear that by so doing we minimise the total error between the mathematical line segment and what actually gets drawn on the display. The error resulting from this new point can now be written back into whole process for the next point along the line, at x+2., this will allow us to repeat the The new value of error can adopt one of two possible values, depending on what new point is plotted. If (x+1,y) is chosen, the new value of error is given by: Otherwise it is: This gives an algorithm for a DDA which avoids rounding operations, instead using the error variable to control plotting: This still employs floating point values. Consider, however, what happens if we multiply across both sides of the plotting test by and then by 2: All quantities in this inequality are now integral. Substitute for. The test becomes: This gives an integer-only test for deciding which point to plot.

The update rules for the error on each step may also be cast into versions of the update rules: form. Consider the floatingpoint Multiplying through by yields: which is in form. Using this new ``error'' value, line drawing algorithm:, with the new test and update equations gives Bresenham's integer-only Integer only - hence efficient (fast). Multiplication by 2 can be implemented by left-shift. This version limited to slopes in the first octant,. 2. Explain the cohen-sutherland line clipping algorithm in detail. (Jun2012) 10M Ans: Basic Idea Encode the line endpoints

Successively divide the line segments so that they are completely contained in the window or completely lies outside the window Clipping happens as follows : 3. Derive the mathematical formula for bresenham s mid point line algorithm. (Dec2011) 10M Ans: Consider drawing a line on a raster grid where we restrict the allowable slopes of the line to the range. If we further restrict the line-drawing routine so that it always increments x as it plots, it becomes clear that, having plotted a point at (x,y), the routine has a severely limited range of options as to where it may put the next point on the line: It may plot the point (x+1,y), or: It may plot the point (x+1,y+1). So, working in the first positive octant of the plane, line drawing becomes a matter of deciding between two possibilities at each step. We can draw a diagram of the situation which the plotting program finds itself in having plotted (x,y).

In plotting (x,y) the line drawing routine will, in general, be making a compromise between what it would like to draw and what the resolution of the screen actually allows it to draw. Usually the plotted point (x,y) will be in error, the actual, mathematical point on the line will not be addressable on the pixel grid. So we associate an error,, with each y ordinate, the real value of y should be. This error will range from -0.5 to just under +0.5. In moving from x to x+1 we increase the value of the true (mathematical) y-ordinate by an amount equal to the slope of the line, m. We will choose to plot (x+1,y) if the difference between this new value and y is less than 0.5. Otherwise we will plot (x+1,y+1). It should be clear that by so doing we minimise the total error between the mathematical line segment and what actually gets drawn on the display. The error resulting from this new point can now be written back into, this will allow us to repeat the whole process for the next point along the line, at x+2. The new value of error can adopt one of two possible values, depending on what new point is plotted. If (x+1,y) is chosen, the new value of error is given by: Otherwise it is: This gives an algorithm for a DDA which avoids rounding operations, instead using the error

va riable to control plotting: This still employs floating point values. Consider, however, what happens if we multiply across both sides of the plotting test by and then by 2: All quantities in this inequality are now integral. Substitute for. The test becomes: This gives an integer-only test for deciding which point to plot. The update rules for the error on each step may also be cast into versions of the update rules: form. Consider the floatingpoint

Multiplying through by yields: whi ch is in form. Using this new ``error'' value, line drawing algorithm:, with the new test and update equations gives Bresenham's integer-only Integer only - hence efficient (fast). Multiplication by 2 can be implemented by left - shift. This version limited to slopes in the first octant,. 4. What do you mean by antialiasing? Explain. (Jul2011) 4M Ans: You might have noticed in some of your OpenGL pictures that lines, especially nearly horizontal or nearly vertical ones, appear jagged. These jaggies appear because the ideal line is approximated by a series of pixels that must lie on the pixel grid. The jaggedness is called aliasing, and this section describes antialiasing techniques to reduce it. Figure 6-2 shows two intersecting lines, both aliased and antialiased. The pictures have been magnified to show the effect.

5. Explain Liang Barsky line clipping algorithm in detail. (Jun2010) 10M Ans: