Download presentation

Presentation is loading. Please wait.

Published bySkye Baile Modified over 3 years ago

1
Scan Conversion A. Samal

2
Scan Conversion Last step in the graphics pipeline Efficiency is a central issue Common primitives – Lines – Polygons – Circles Hardware implementations preferable

3
Lines Compute the coordinate of the pixels that lie on a line on a 2D raster Defined by the coordinates of the end points Criteria – Thin – As close to ideal as possible – 1 pixel wide If -1<= slope <= 1 exactly 1 pixel in one column Else exactly 1 pixel in one row – Constant brightness, independent of the length & orientation – Should be drawn fast

4
Scan Conversion of Lines

5
Basic Incremental Algorithm

6
Problem for each x plot pixel at closest y – Problems for steep lines

7
Basic Incremental Algorithm Desired Line

8
Basic Incremental Algorithm Brute force algorithm Inefficient Each iteration – Floating point multiply – Floating point addition – Rounding

9
Basic Incremental Algorithm Eliminate the multiplication Incremental computation Digital Differential Analyzer (DDA)

10
Basic Incremental Algorithm If the magnitude of the slope is more than 1 change the role of x and y in the algorithm – y increases faster than x Simple but inefficient – Still there are floating point operations Bresenham’s algorithm – Uses only integer arithmetic – Avoids round function – Extended to drawing circles

11
Midpoint Line Algorithm E NE M Previous Pixel Current Pixel Choices Next Pixel Choices

12
Midpoint Line Algorithm Compute the distance between – Q and E – Q and NE See which side of the line M lies M lies below the line – Choose NE M lies above the line – Choose E M lies on the line – Choose either E NE M Previous Pixel Current Pixel Choices Next Pixel Choices

13
Midpoint Line Algorithm

15
E NE M Previous Pixel Current Pixel Choices Next Pixel Choices

16
Midpoint Line Algorithm What happens at the next grid point? – Depends on whether we choose N or NE If E is chosen E NENE M Previo us Pixel Current Pixel Choices Next Pixel Choices

17
Midpoint Line Algorithm If NE is chosen E NENE M Previo us Pixel Current Pixel Choices Next Pixel Choices

18
Midpoint Line Algorithm Summary – Choose between the two pixels (E/NE) based on the sign of the decision variable d=F(M) – Update the decision variable by adding the change along that direction – Repeat this process until the end point is reached

19
Midpoint Line Algorithm

20
Fractional arithmetic still problematic Should be avoided if possible Redefine F(x,y) by multiplying by 2 Thus F(x,y) = 2(ax+by+c) Replace all constants and the decision variable by 2 Removes all multiplications; only additions left

21
Midpoint Line Algorithm

22
MidpointLine(x0,y0,x1,y1,color) { int dx,dy,dE,dNE,d,x,y; dx=x1-x0; dy=y1-y0; d=2*dy-dx; dE=2*dy; dNE=2*(dy-dx); x=x0;y=y0; DrawPixel(x,y,color); for(x=x0;x

23
Bresenham’s Algorithm An example 456789 7 8 9 10 11 12

24
Bresenham’s Algorithm An example 456789 7 8 9 10 11 12

25
Bresenham’s Algorithm An example 456789 7 8 9 10 11 12

Similar presentations

OK

Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.

Triangle Scan Conversion. 2 Angel: Interactive Computer Graphics 5E © Addison-Wesley 2009 Rasterization Rasterization (scan conversion) –Determine which.

© 2018 SlidePlayer.com Inc.

All rights reserved.

To ensure the functioning of the site, we use **cookies**. We share information about your activities on the site with our partners and Google partners: social networks and companies engaged in advertising and web analytics. For more information, see the Privacy Policy and Google Privacy & Terms.
Your consent to our cookies if you continue to use this website.

Ads by Google

Ppt on non ferrous minerals Lecture ppt on anemia Ppt on switching network Ppt on tourism in delhi and its promotion Ppt on business environment nature concept and significance of the number Ppt on formal letter writing Ppt on non biodegradable waste list Ppt on conservation of wildlife and natural vegetation in pakistan Ppt on group development models Ppt on email etiquettes presentation church