Rasterizing Lines 2 Lecture 33 Wed, Nov 14, 2007.

Slides:



Advertisements
Similar presentations
Graphics Primitives Part II: Bresenhams line and circle.
Advertisements

Graphics Primitives: line
For(int i = 1; i
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.
4- 1 Raster Display Model Pixel (Picture Element, 像素 )
CS 376 Introduction to Computer Graphics 02 / 02 / 2007 Instructor: Michael Eckmann.
Computer Graphics 4: Bresenham Line Drawing Algorithm, Circle Drawing & Polygon Filling By:Kanwarjeet Singh.
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.
Scan Conversion Algorithms
ECE291 Computer Engineering II Lecture 19 Josh Potts University of Illinois at Urbana- Champaign.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
Lecture 17 Fun with Graphics Dr. Dimitrios S. Nikolopoulos CSL/UIUC.
The lines of this object appear continuous However, they are made of pixels 2April 13, 2015.
CS 376 Introduction to Computer Graphics 01 / 29 / 2007 Instructor: Michael Eckmann.
Lecture 16 Fun with graphics
Standard 10 add, subtract, multiply, and divide monomials and polynomials monomials are just one thing binomials are like bx + c polynomials are like ax².
QUADTRATIC RELATIONS Standard Form.
University of Missouri at Columbia 2D Scan-line Conversion University of Missouri at Columbia.
Rasterizing primitives: know where to draw the line Dr Nicolas Holzschuch University of Cape Town Modified.
Scan Conversion. Also known as rasterization In our programs objects are represented symbolically –3D coordinates representing an object’s position –Attributes.
College of Computer and Information Science, Northeastern UniversitySeptember 12, CS U540 Computer Graphics Prof. Harriet Fell Spring 2009 Lecture.
1 CPE 333 : Computer Graphics มหาวิทยาลัยเทคโนโลยีพระจอม เกล้าธนบุรี Dr. Natasha Dejdumrong.
Graphics Primitives: line. Pixel Position
Scan Conversion Line and Circle
Computing & Information Sciences Kansas State University CIS 536/636 Introduction to Computer Graphics Lecture 6 of 41 William H. Hsu Department of Computing.
Tools for Raster Displays CVGLab Goals of the Chapter To describe pixmaps and useful operations on them. To develop tools for copying, scaling, and rotating.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
CE Statics Lecture 5. Contents Position Vectors Force Vector Directed along a Line.
Introduction Computer Graphics & Its application Types of computer graphics Graphic display : random Scan & Raster Scan display Frame buffer and video.
Chapter 3 Scan Conversion Lecture-02. Bresenham’s Line Algorithm Bresenham’s line algorithm – is a highly efficient incremental method for scan- converting.
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.
CS-321 Dr. Mark L. Hornick 1 Line Drawing Algorithms.
CS 325 Introduction to Computer Graphics 02 / 03 / 2010 Instructor: Michael Eckmann.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
Graphics Pipeline Rasterization CMSC 435/634. Drawing Terms Primitive – Basic shape, drawn directly – Compare to building from simpler shapes Rasterization.
Use midpoint and distance formulas. Vocabulary Midpoint: the midpoint of a segment is the point that divides the segment into two congruent segments (It.
Lecture 13: Raster Graphics and Scan Conversion
Int fact (int n) { If (n == 0) return 1; else return n * fact (n – 1); } 5 void main () { Int Sum; : Sum = fact (5); : } Factorial Program Using Recursion.
Kansas State University Department of Computing and Information Sciences CIS 736: Computer Graphics Friday, January 21, 2000 William H. Hsu Department.
Example: (7,9) (12,0) Example 2: Point1 V:(7,9 ) C:( 0,255,0) Point2 V:(12,0) C:(0,255,0) (0,0) (18,0) (0,9) What are the problems with this method? Slope>1.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
1 Then the lengths of the legs of ABC are: AC = |4 – (–3)| = |7| = 7 BC = |6 – 2| = |4| = 4 To find the distance between points A and B, draw a right triangle.
Rasterization CENG 477 Introduction to Computer Graphics Slides from Steve Marschner, CS4620, 2008 Cornell University.
Rasterization, or “What is glBegin(GL_LINES) really doing?” Course web page: February 23, 2012  Lecture 4.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Computer Graphics Drawing Line.
Warm Up.
Introduction to the Microscope
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Prof. Harriet Fell Spring 2007 Lecture 5 – January 17, 2006
Methods Anti-Aliasing Super Sampling
Midpoint and Distance in the Coordinate Plane
Quadratic Graphs - Parabolas
Your sock drawer contains ten white socks and ten black socks.
2 Terms 3 Terms 4 Terms Always look for a GCF! Always look for a GCF!
2D Scan-line Conversion
Rasterizing Lines 1 Lecture 32 Mon, Nov 12, 2007.
Add or Subtract? x =.
Edited from The Rasterization Problem: Idealized Primitives Map to Discrete Display Space Edited from.
Shading Polygons Lecture 36 Wed, Nov 28, 2007.
Rasterizing Polygons 2 Lecture 35 Mon, Nov 26, 2007.
Rasterizing Polygons Lecture 29 Wed, Dec 7, 2005.
Line Drawing Algorithms
HW-rast nccu cg
Clipping Polygons Lecture 31 Fri, Nov 9, 2007.
Ch 10: Polynomials G) Completing the Square
Presentation transcript:

Rasterizing Lines 2 Lecture 33 Wed, Nov 14, 2007

Bresenham’s Midpoint Algorithm The algorithm. Initialize x = ax, y = ay., F = 3H – 2W. Increment x. If F < 0, then Add 2H to F. If F > 0, then Subtract 2(W – H) Increment y.

Bresenham’s Midpoint Algorithm This algorithm produces the coordinates of the grid point to the lower left of the pixel to be shaded.

Example Rasterize the line from (0, 0) to (16, 7). W = 16, H = 7. 2H = 14, 2(W – H) = 18, 3H – 2W = -11. x F y y -11 1 3 2 -15 -1 4 13 5 -5 x F y y 6 9 1 2 7 -9 3 8 5 -13 4 10 11 -17 x F y y 12 -3 5 13 11 1 14 -7 6 15 7

Lines and Pixels (16, 7) (0, 0)

Another Example Rasterize the line from (3, 5) to (16, 14). W = 13, H = 9. 2H = 18, 2(W – H) = 8, 3H – 2W = 1. x F y y 3 1 5 4 -7 6 11 7 -5 8 13 9 x F y y 10 -3 11 15 1 12 7 13 -1 14 17 9

Example 14 5 3 16

Bresenham’s Algorithm void bresenham(Point2 A, Point2 B) { int y = A.y; int W = B.x – A.x; int H = B.y – A.y; int H2 = 2*H; int WH2 = 2*(W – H); int F = 3*H – 2*W; for (int x = A.x; x < B.x; x++) setPixel(x, y); if (F < 0) F += H2; else F -= WH2; y++; }

Bresenham’s Algorithm Read Run

OpenGL’s Line Drawer Read Run

Freehand Drawing Read Run