Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.

Slides:



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

Graphics Primitives: line
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.
Line Drawing Algorithms
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.
ECE291 Computer Engineering II Lecture 19 Josh Potts University of Illinois at Urbana- Champaign.
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.
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.
Computer Graphics Tz-Huan Huang National Taiwan University (Slides are based on Prof. Chen’s)
OUTPUT PRIMITIVES Screen vs. World coordinate systems ● Objects positions are specified in a Cartesian coordinate system called World Coordinate.
Lecture 16 Fun with graphics
Raster conversion algorithms for line and circle
Output Primitives Computer Graphics.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics May 3, 2007.
CS123 | INTRODUCTION TO COMPUTER GRAPHICS Andries van Dam © Scan Conversion CS123 1 of 44Scan Conversion - 10/14/2014.
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
1/1/20001 Topic >>>> Scan Conversion CSE Computer Graphics.
Dr. S.M. Malaek Assistant: M. Younesi
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.
Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.
1Computer Graphics Implementation III Lecture 17 John Shearer Culture Lab – space 2
Introduction Computer Graphics & Its application Types of computer graphics Graphic display : random Scan & Raster Scan display Frame buffer and video.
Graphics Output Primitives
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)
Image Synthesis Rabie A. Ramadan, PhD 7. 2 Image Rasterization.
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.
Lecture 13: Raster Graphics and Scan Conversion
Bresenham’s Line Algorithm
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Rasterization Overview Raster Display Device. Scan Conversion / Rasterization: converting vector graphics into raster graphics (determining pixels in.
Computer Graphics : Bresenham Line Drawing Algorithm, Circle Drawing
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.
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.
Scan Conversion of Line Segments. What is Scan conversion? Final step of rasterization (the process of taking geometric shapes and converting them into.
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
CSCE 441 Lecture 2: Scan Conversion of Lines
Lecture 9 Line Drawing Algorithms (Bresenham’s Line Algorithm)
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Lecture 8 Shear and Line Drawing Algorithms
University of New Mexico
Implementation III.
Chapter Three Part I Output Primitives CS 380.
Introduction to Computer Graphics with WebGL
CSCE 441 Lecture 2: Scan Conversion of Lines
Introduction to Computer Graphics
Rasterization and Antialiasing
Computer Graphics Implementation III
Rasterization and Antialiasing
Chapter 3 Graphics Output Primitives
Type to enter a caption. Computer Graphics Week 1 Lecture 2.
HSR & Scan conversion 신승영.
Implementation III Ed Angel Professor Emeritus of Computer Science
Line Drawing Algorithms
Presentation transcript:

Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction

How does computer draw line? Screen made of pixels High-level language specifies line System must color pixels

line drawing definition :- Given two 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 from P and ending at Q.

Equation for a straight line Equation for a straight line is y= m. x + b m is the slope of the line and b is the y intercept. Given the endpoints of a line segment. m = y2-y1 / x2-x1 b= y1-m.x1

DDA Algorithm Start with starting and ending coordinates of the line: (x0, y0) and (x1, y1) Color first pixel (round to nearest integer) Suppose x1-x0 > y1-y0 (gentle slope) –There will be x1-x0 steps (# pixels to be colored) Set x=x0, y=y0 At each step, –increment x by (x1-x0)/numsteps, and –increment y by (y1-y0)/numsteps For each step, round off x and y to nearest integer, and color pixel

Bresenham’s Algorithm Uses only integer calculations Uses distance between ideal y- coordinate and the upper and lower pixel. d upper d lower

Bresenham’s Algorithm 1.Input the two line endpoints and store left endpoint as (x0,y0) 2.Pre-calculate the values dx, dy, 2dy and 2dy - 2dx 3.Color pixel (x0,y0) 4.Let p 0 = 2dy – dx 5.At each x k along the line, starting with k=0: 6.Repeat Step-4 dx times If p k <0, then the next point to plot is (x k + 1,y k ), and p k+1 = p k + 2dy Otherwise, the next point to plot is (x k + 1, y k + 1), and p k+1 = pk + 2dy – 2dx

Bitmap font Bitmap font : A simple method for representing the character shapes in a particular typeface is to use rectangular grid pattern.

Bitmap font The character grid only need to be mapped to a frame buffer position. Bitmap fonts required more space, because each variation (size and format) must be stored in a font cash. Bold Italic The character grid only need to be mapped to a frame buffer position. Bitmap fonts required more space, because each variation (size and format) must be stored in a font cash.

Outline Font Graphic primitives such as lines and arcs are used to define the outline of each character. Require less storage since variation does not require a distinct font cash.

Outline Font We can produce boldface, italic, or different size by manipulating the curve definition for the character outlines. It does take more time to process the outline fonts, because they must be scan converted into frame buffer.