Lecture 8 Shear and Line Drawing Algorithms

Slides:



Advertisements
Similar presentations
Graphics Primitives: line
Advertisements

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.
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
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.
Computer Graphics Lecture 3 Line & Circle Drawing.
30/9/2008Lecture 21 Computer Graphics Assistant Professor Dr. Sana’a Wafa Al-Sayegh 2 nd Semester ITGD3107 University of Palestine.
Lecture 2 Line & Circle Drawing
The lines of this object appear continuous However, they are made of pixels 2April 13, 2015.
OUTPUT PRIMITIVES Screen vs. World coordinate systems ● Objects positions are specified in a Cartesian coordinate system called World Coordinate.
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.
Line Drawing by Algorithm. Line Drawing Algorithms Line drawn as pixels Graphics system –Projects the endpoints to their pixel locations in the frame.
CS 450: COMPUTER GRAPHICS DRAWING LINES AND CIRCLES SPRING 2015 DR. MICHAEL J. REALE.
Section P.5 Linear Equations in Two Variables 1.Slope: can either be a ratio or a rate if the x and y axis have the same units of measures then the slope.
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.
CS 325 Introduction to Computer Graphics 02 / 01 / 2010 Instructor: Michael Eckmann.
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.
CS-321 Dr. Mark L. Hornick 1 Line Drawing Algorithms.
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.
Rendering.
1 Teaching Innovation - Entrepreneurial - Global The Centre for Technology enabled Teaching & Learning, N Y S S, India DTEL DTEL (Department for Technology.
Bresenham’s Line Algorithm
OUTPUT PRIMITIVES A.Aruna/Faculty of Information technology/SNSCE13/19/2016.
Lecture 2: 19/4/1435 Graphical algorithms Lecturer/ Kawther Abas CS- 375 Graphics and Human Computer Interaction.
Computer Graphics CC416 Lecture 04: Bresenham Line Algorithm & Mid-point circle algorithm Dr. Manal Helal – Fall 2014.
Computer Graphics Inf4/MSc Computer Graphics Lecture 4 Line & Circle Drawing.
10/10/2006TCSS458A Isabelle Bichindaritz1 Line and Circle Drawing Algorithms.
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.
Computer Graphics Lecture 05 Line Drawing Techniques Taqdees A. Siddiqi
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
Raster Graphics.
Lecture 9 Line Drawing Algorithms (Bresenham’s Line Algorithm)
CS 4731: Computer Graphics Lecture 20: Raster Graphics Part 1
Lecture 05: Mid-point Ellipse algorithm Dr. Manal Helal – Fall 2014
Equations of Lines.
Chapter Three Part I Output Primitives CS 380.
CSCE 441 Lecture 2: Scan Conversion of Lines
2D Scan-line Conversion
Rasterization and Antialiasing
Rasterization and Antialiasing
3.1 Reading Graphs; Linear Equations in Two Variables
Scan Conversion (From geometry to pixels)
Chapter 3 Graphics Output Primitives
Type to enter a caption. Computer Graphics Week 1 Lecture 2.
Line Drawing Algorithms
INTERACTIVE COMPUTER GRAPHICS
Presentation transcript:

Lecture 8 Shear and Line Drawing Algorithms Computer Graphics Lecture 8 Shear and Line Drawing Algorithms

Shear It is a transformation that distorts the shape of an object. It means “pulling or elongating” a graphical object to right, left, up or down. It can be done along x-axis or along y-axis. Shear along x-axis x’ 1 shx 0 x y’ = 0 1 0 . y 1 0 0 1 1 x’ = x + shx.y y’ = y

shx can be assigned any real number. y y x x Positive values of shx shift the coordinate positions towards right and negative values shift them to left.

Example Shear the following object along x-axis, shx = 2 (0,1) (1,1) (2,1) (3,1) (0,0) (1,0) (0,0) (1,0)

For point (0,1) x’ = x + shx.y x’ = 0 + 2.1 = 2 (0,1) = (2,1) For point (1,1) x’ = 1 + 2. 1 = 3 => (1,1) = (3,1)

For shearing in x-direction relative to other reference lines, that is, shifting coordinate positions by an amount equal to its distance from reference line y = yref x’ = x + shx (y – yref) , (0,1) (1,1) (1,1) (2,1) (0,0) (1,0) (1/2, 0) (3/2,0) yref -1

Shear in y-direction In this case x’ = x y’ = y + shy (x – xref)

Line Drawing Algorithms In random scan systems, a straight line can be drawn from one endpoint to other by using line drawing commands from frame buffer. In raster scan systems the color intensities for a line are stored in the frame buffer and are read from the frame buffer. In order to draw lines, we use the equation of straight line which is given as y = mx + b m= slope of line (that is, how steep line is) b = y intercept, y= how far up, x = how far along

y m b x y2 (x2,y2) y1 (x1,y1) x1 x2

The slope m of a line is equal to the change in y divided by change in x, that is: m = change in x = y2 - y1 change in y x2 - x1 m = δy δx => δy = m . δx => δx = δy m

Positive Slope : On increasing x if y also increases then slope is positive. Negative Slope : On increasing x if y decreases then the slope is negative. y y m m positive slope negative slope x x

Digital Differential Analyzer (DDA) It is a scan conversion line drawing algorithm. It is based on calculating either δy or δx using equations δy = m . δx and δx = δy / m In this algorithm, the line is sampled at unit intervals in one coordinate and the integer nearest to the line path for other coordinate are determined. We will consider a line with positive slope.

Line with positive slope

Case 1: slope is less than or equal to 1 (m<=1) In this case, the line is sampled at unit x intervals and then the y-values are computed. δy = m . δx δy = m (δx = 1) => yk+1 – yk = m => yk+1 = yk + m [This means the next point in x is +1 and next point in y is +m]

Case 2: slope is greater than 1 (m > 1) In this case the roles of x and y are exchanged. Now number of steps is determined by y (δy = 1) and the line is sampled at unit y intervals and values of x are computed. δx = δy / m δ x = 1 / m (δy = 1) xk+1 – xk = 1 / m xk+1 = xk + 1 / m

DDA Algorithm Input x1, y1, x2, y2 dx = x2 – x1 dy = y2 – y1 If dx > dy steps = dx Else steps = dy xincrement = dx / steps yincrement = dy / steps x = x1 y = y1 for (i=0; i< steps; i++) x = x + xincrement y = y + yincrement