OUTPUT PRIMITIVES / DISPLAY TECHNIQUES

Slides:



Advertisements
Similar presentations
Graphics Primitives: line
Advertisements

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.
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.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
2D Output Primitives Graphics packages provide basic operations (called primitive operations) to describe a scene in terms of geometric structures. The.
Raster conversion algorithms for line and circle
Bresenham’s Midpoint Algorithm CS5600 Computer Graphics Rich Riesenfeld Spring 2006 Lecture Set 1.
CS5500 Computer Graphics © Chun-Fa Chang, Spring 2007 CS5500 Computer Graphics May 3, 2007.
C O M P U T E R G R A P H I C S Guoying Zhao 1 / 50 C O M P U T E R G R A P H I C S Guoying Zhao 1 / 45 Computer Graphics Implementation I.
Graphics Output Primitives Pixel Addressing and Fill Area Dr. M. Al-Mulhem Feb. 1, 2008.
University of Missouri at Columbia 2D Scan-line Conversion University of Missouri at Columbia.
Line Drawing by Algorithm. Line Drawing Algorithms Line drawn as pixels Graphics system –Projects the endpoints to their pixel locations in the frame.
Rasterization Foley, Ch: 3. Pixels are represented as disjoint circles centered on uniform grid Each (x,y) of the grid has a pixel Y X (1,1) (1,2) (0,0)
©Zachary Wartell, Larry F. Hodges Scan Conversion I Revision 1.6 8/9/2007 Copyright 2006, Dr. Zachary Wartell, UNCC, All Rights Reserved.
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Circle Drawing algo..
Bresenham’s Algorithm. Line Drawing Reference: Edward Angel’s book: –6 th Ed. Sections 6.8 and 6.9 Assuming: –Clipped (to fall within the window) –2D.
CGMB214: Introduction to 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 450: COMPUTER GRAPHICS REVIEW: DRAWING ELLIPSES AND OTHER CURVES SPRING 2015 DR. MICHAEL J. REALE.
Informationsteknologi Monday, November 26, 2007Computer Graphics - Class 121 Today’s class Drawing lines Bresenham’s algorithm Compositing Polygon filling.
Larry F. Hodges 1 Design of Line and Circle Algorithms.
Introduction Computer Graphics & Its application Types of computer graphics Graphic display : random Scan & Raster Scan display Frame buffer and video.
Graphics Output Primitives
Image Synthesis Rabie A. Ramadan, PhD 7. 2 Image Rasterization.
MIDPOINT CIRCLE & ELLIPSE GENERARTING ALGORITHMS
Midpoint Circle Algorithm
1 CSCE 441 Lecture 2: Scan Conversion of Lines Jinxiang Chai.
GEOMETRY AND LINE GENERATION Geometry and Line Generation Chapter 2.
Scan Conversion.
Lecture 13: Raster Graphics and Scan Conversion
Computer Graphics Inf4/MSc Computer Graphics Lecture 4 Line & Circle Drawing.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
Computer Graphics Lecture 07 Ellipse and Other Curves Taqdees A. Siddiqi
Computer Graphics Lecture 06 Circle Drawing Techniques Taqdees A. Siddiqi
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.
Objectives Understand Bresenhams line drawing algorithm. Apply the algorithm to plot a line with the end points specified.
Primitive graphic objects
Scan Conversion or Rasterization
Computer Graphics Drawing Line.
CSCE 441 Lecture 2: Scan Conversion of Lines
Computer graphics 2D graphics.
Raster Graphics.
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Scan Conversion or Rasterization
Computer Graphics Implementation I.
Lecture 05: Mid-point Ellipse algorithm Dr. Manal Helal – Fall 2014
Chapter Three Part I Output Primitives CS 380.
CSCE 441 Lecture 2: Scan Conversion of Lines
Scan Conversion of Circles
2D Scan-line Conversion
Allah says Say, "Allah created cattle for you. In them you find warmth and benefit and from them you eat. In them there is beauty for you when you bring.
Introduction to Computer Graphics
Edited from The Rasterization Problem: Idealized Primitives Map to Discrete Display Space Edited from.
Scan Conversion (From geometry to pixels)
Chapter 3 Graphics Output Primitives
Primitive Drawing Algorithm
Primitive Drawing Algorithm
S.JOSEPHINE THERESA, DEPT OF CS, SJC, TRICHY-2
Line Drawing Algorithms
Presentation transcript:

OUTPUT PRIMITIVES / DISPLAY TECHNIQUES LINE DRAWING TO DRAW LINE FROM (X1 Y1) TO (X2 Y2) (x2 y2) (x1y1)

RASTER SCREEN (x2 y2) (x1 y1)

DIGITAL DIFFERENTIAL ANALYZER (DDA) y = m x + b m = (y2 - y1) / (x2 - x1) = y / x = dely / delx xk+1 = xk +  delx yk+1 = yk +  dely  = ?????

TWO ALTERNATIVES  = 1 / max [(x2-x1), (y2 - y1)] (BOOK)  = 1 / 2 K WHERE K IS SUCH THAT 2K-1 < (max [(x2-x1), (y2 - y1)])  2K

SIMPLE DDA delx = x2 - x1; dely = y2 - y1; steps = abs(dely); if abs (delx) > abs (dely) then steps = abs(delx); xinc = delx / steps; yinc = dely / steps; x = x1; y = y1; drawpixel (round(x), round(y)) for k = 1 to steps do begin x = x + xinc; y = y + yinc; end

BRESENHAM’S ALGO WHICH PIXEL NEXT ?? ? 2 (xk yk) ? 1

BRESENHAM’S ALGO (contd) Deviations from the specified line path d1 = y - yk = m (xk + 1) + b - yk d2 = yk + 1 -y = yk + 1 - m (xk + 1) - b d1 - d2 = 2 m (xk + 1) - 2yk + 2b -1 m = (y / x) pk = x (d1 - d2) = 2y . xk - 2x . yk + c

Pk = error at beginning of next pixel If (at end of iteration k) true-line is below centre of pixel (pk < 0), draw pixel 1 else draw pixel 2 (in iteration k+1) 2 1

Brezenham’s algo (contd) pk+1 - pk = 2 y (xk+1 -xk) - 2x (yk+1 -yk) = 2 y - 2x (yk+1 -yk) For pixel 1: = 2 y For pixel 2: = 2 y - 2x Hence if pk < 0, choose pixel 1 in iteration k+1, pk+1 = pk + 2 y else choose pixel 2 in iteration k+1, pk+1 = pk +2 y - 2 x Initial p0 = 2 y - x

Brezenham’s algo (contd) pk + m - 1 pk + m pk = p0 = m - 0.5

Circle Generation (x - a)2 + (y - b)2 = r2 OR x = a + r cos ; y = b + r sin  (Fixed angular step size with lines between them) (Step Size = 1/r) OR m = dy / dx = - (x - a) / (y - b) USE DDA with m as above

MIDPOINT CIRCLE ALGO Next midpoint ?? 1 yk Yk - 1 ?? 2 xk xk + 1

MIDPOINT CIRCLE f (x, y) = x2 + y2 - r2 pk = (xk + 1)2 + (yk - 0.5)2 - r2 (error at next midpoint) If pk < 0 then Pixel 1 Else Pixel 2 (is closer to circle in iteration k+1) pk+1 = [(xk + 1) + 1]2 + (yk+1 - 0.5)2 - r2 pk+1 = pk + 2 (xk + 1) + (yk+12 - yk2) - (yk+1 -yk) + 1

MID POINT CIRCLE (contd) Pk+1 - pk = 2 xk+1 + 1 OR = 2 xk+1 + 1 - 2yk+1 p0 = 5/4 - r (PLEASE DERIVE) INITIAL POINT = (0, r) GET ONE POINT AND DUPLICATE IN 8 OCTANTS

ELLIPSE DRAWING SLOPE BASED (DDA) MIDPOINT ALGO [(x - a) / rx]2 + [(y - b) / ry]2 = 1 f (x, y) = (x - a)2 ry2 + (y - b)2 rx2 -rx2 ry2 dy / dx = ???? If f(x, y) < 0, point is inside the ellipse

MIDPOINT ELLIPSE (contd) Where slope < 1, xk+1 = xk + 1 Where slope > 1, yk+1 = yk - 1 pk = ???? Pk+1 - pk = ???? (For Regions 1 and 2)

OTHER CURVES FOR IMPLICIT CURVES F (X, Y) = 0, DEVELOP MIDPOINT ALGO (eg, hyperbola, parabola)

OTHER CURVES FOR EXPLICIT CURVES Y = F(X), OR PARAMETRIC CURVES - APPROXIMATE WITH STRAIGHT LINE SEGMENTS Generate points at constant parameter values Join them by straight lines Closer points for larger curvatures

ADDRESSING PIXELS BY PIXEL CENTERS BY GRID OF PIXEL BOUNDARY LINES (H & V) PREFERRED, AS NO HALF INTEGER BOUNDARIES PRECISE OBJECT REPRESENTATIONS CONVENIENT IN RASTER ALGOS

SIZE OF OBJECTS RECTANGLE (0, 0) --- (4, 3) ? ? ? ? ? ? ? (4, 3)