Bresenham algorithm

2,171 views 42 slides Nov 21, 2018
Slide 1
Slide 1 of 42
Slide 1
1
Slide 2
2
Slide 3
3
Slide 4
4
Slide 5
5
Slide 6
6
Slide 7
7
Slide 8
8
Slide 9
9
Slide 10
10
Slide 11
11
Slide 12
12
Slide 13
13
Slide 14
14
Slide 15
15
Slide 16
16
Slide 17
17
Slide 18
18
Slide 19
19
Slide 20
20
Slide 21
21
Slide 22
22
Slide 23
23
Slide 24
24
Slide 25
25
Slide 26
26
Slide 27
27
Slide 28
28
Slide 29
29
Slide 30
30
Slide 31
31
Slide 32
32
Slide 33
33
Slide 34
34
Slide 35
35
Slide 36
36
Slide 37
37
Slide 38
38
Slide 39
39
Slide 40
40
Slide 41
41
Slide 42
42

About This Presentation

Bresenham algorithm


Slide Content

Daffodil International University WELCOME TO OUR PRESENTATION

Name : Professor Dr. Md. Ismail Jabiullah Designation Professor   Department Department of Computer Science and Engineering SUBMITTED TO

Yasir Arefin Tusher 152-15-5944 MD Rubel 152-15-6037 MD A rifur Rahman 152-15-5830 Sk.Mehedi Hasan 161-15-7667 Raisa Tabassum 152-15-6022 Arafat Rahman 152-15-5983 SUBMITTED By

The representation and manipulation of image data by a computer INTRODUCTION TO COMPUTER GRAPHICS

INTRODUCTION DIU The term computer graphics refers to "almost everything on computers that is not text or sound” Refers to creation, Storage and manipulation of pictures and drawing using a digital computer. Effective tool for presenting information.

WHAT IS COMPUTER GRAPHICS? DIU Creation, Manipulation, and Storage of geometric objects (modelling) and their images (rendering). Display those images on screens or hardcopy devices Image processing

HISTORY OF COMPUTER GRAPHICS (1951–1959)s Data was displayed on printers. Used CRT and light pen for user interactive environment Design

HISTORY OF COMPUTER GRAPHICS 1960 – William Fetter  Introduced phrase “Computer Graphics”

HISTORY OF COMPUTER GRAPHICS 1970’s – powerful PCs to draw basic and complex shapes

HISTORY OF COMPUTER GRAPHICS 1980’s – artists and graphics designers preferred to use Macintosh and PCs Late 1980’s – 3-D computer graphics with SGI (Silicon Graphics) computers

HISTORY OF COMPUTER GRAPHICS 1990’s onwards – 3D graphics in gaming, multi media and animation, GUI

HISTORY OF COMPUTER GRAPHICS 3D rendering capabilities became a standard feature after in 2000 ’s

APPLICATIONS OF COMPUTER GRAPHICS DIU COMPUTER AIDED DESIGN (CAD) ANIMATION COMPUTER GAMES VISUALIZATION GRAPHICAL PRESENTATION

COMPUTER AIDED DESIGN DIU Computer Aided Design(CAD) is the Use of Computer System to Assist in the Creation , Modification , Analysis or Optimization of Design.

VISUALIZATIN DIU Visualization is any Technique For Creating Images , Diagrams or Animations To Communicate A Message.

ANIMATION DIU Animation is the process of creating a continuous motion & shape change illusion by means of rapid display of a sequence of static images that minimally differ from each other

COMPUTER GAMES DIU Computer games are video games played on a general purpose personal computer

DISPLAY OF INFORMATION: Graphics for Scientific, Engineering, and medical Data Nebula Medical Image

Entertainment: Computer Graphics methods are used in making music videos ,games ,cartoon movies ,television shows etc. Graphics for Movie, cartoon etc movie cartoon

LINE DRAWING ALGORITHMS DIU There are two basic line drawing algorithm…. DDA line drawing algorithm Bresenham’s Line Drawing Algorithm

REFERENCES TOOTHLESS GEAR https://en.wikipedia.org/wiki/Computer_graphics iu.edu.jo/files/ FacultyIT / slides_it / ComputerGraphics /DrJamalLecture01.pdf https://www.civilsimplified.com/resources/What-is-computer-aided-design https://en.wikipedia.org/wiki/Visualization_(graphics) https://en.wikiquote.org/wiki/Animation

Bresenham's Line Algorithm

DESCRIPTIONS DIU Bresenham’s line algorithm is an algorithm,that determines the points of an n -dimensional raster that should be selected in order to form a close approximation to a straight line between two points. The Bresenham’s algorithm is another incremental scan conversion algorithm . The big advantage of this algorithm is that it uses only integer calculations

FIGURE ANALYSIS DIU

ANALYSIS DIU

ANALYSIS DIU

ALGORITHM DIU

Working Process Bresenham’s algorithm for scan-converting a line from P 1 (x 1 , y 1 ) to P 2 (x 2 , y 2 ) with x 1 ’<x 2 ’ and o<m<1 can be stated as follows: int x = x 1 , y =y 1 ; int dx = x 2 - x 1 , dy = y 2 - y 1 , dT = 2( dy - dx), dS = 2dy; int d = 2dy – dx; setPixel ( x,y ); while(x<x 2 ){ x ++ ; if(d<0) d = d + dS ; else{ y ++ ; d = d + dT ; } setPixel (x, y); }

Plot a Line whose Slope is between 0 to 45 using Bresenham’s Line Algorithm Algorithm: Step 1: Compute the initial values: dx = x 2 – x 1 , Inc 2 = 2( dy – dx ) dy = y 2 – y 1 , d = Inc 1 – dx Inc 1 = 2dy Step 2: Set (x, y) equal to the lower left-hand end-point and set x end equal to the largest value of x. If dx < 0, then x = x 2 , y = y 2 and x end = x 1 . If dx > 0, then x = x 1 , y = y 1 and x end = x 2 . Step 3: Plot a point at current (x, y) position. Step 4: Test to see whether the entire line has been drawn. If x> x end , Stop. Step 5: Compute the location of the next pixel. If d<0, then d = d+ inc 1 . If d>=0, then d = d + Inc 2 , and y = y + 1. Step 6: Increment x: x = x+1. Step 7: Plot a point at current (x, y) position. Step 8: Go to Step 4.

Bresenham’s Line Algorithm: Scan- conerting a Line from (1, 1) to (8, 5) Algorithm: Step 1: Find the starting values. Step 2: In this case, dx = x 2 – x 1 = 8 – 1 = 7, dy = y2 – y1 = 5 – 1 = 4. Step 3: Therefore, Inc 1 = 2, dy = 2 x 4 = 8. Inc2 = 2( dy –dx) = 2(4 - 7) = - 6, d= Inc 1 – dx = 8 – 7 = 1. The following table indicates the values computed by the algorithm:

Applications of Bresenham Algorithm Wire-frame Modeling 

Applications of Bresenham Algorithm

EXAMPLE

Advantages of Bresenham Algorithm Uses fixed points Easy to calculate (only addition & subtraction) Fast execution compare to DDA More accurate and efficient

Disadvantages of Bresenham’s Algorithm Drift away from actual line path Causes stair-case pattern

REFERENCES TOOTHLESS GEAR https://en.wikipedia.org/wiki/Computer_graphics iu.edu.jo/files/ FacultyIT / slides_it / ComputerGraphics /DrJamalLecture01.pdf https://www.civilsimplified.com/resources/What-is-computer-aided-design https://en.wikipedia.org/wiki/Visualization_(graphics) https://en.wikiquote.org/wiki/Animation

REFERENCES TOOTHLESS GEAR https://en.wikipedia.org/wiki/Computer_graphics https://www.thecrazyprogrammer.com/2017/01/bresenhams-line-drawing-algorithm-c-c.html https://en.wikipedia.org/wiki/Visualization_(graphics) https://en.wikiquote.org/wiki/Animation

ANY QUESTION?

THANK YOU FOR BEING WITH US!