Lines - PowerPoint PPT Presentation

1 / 7
About This Presentation
Title:

Lines

Description:

How does a machine go about drawing a line defined by a mathematical ... In raster images leads to jagged edges with staircase effect ... – PowerPoint PPT presentation

Number of Views:36
Avg rating:3.0/5.0
Slides: 8
Provided by: isgC
Category:
Tags: jagged | lines

less

Transcript and Presenter's Notes

Title: Lines


1
Lines
  • DDA Line Drawing, Antialiasing

2
Line Drawing
  • How does a machine go about drawing a line
    defined by a mathematical representation (e.g.
    vector, endpoints, parametric, etc.)?
  • How does the continuous line description get
    converted to the discrete pixel representation.
  • Important part of Rasterization process
  • Some common algorithms
  • DDA
  • Bresenhams

3
DDA Algorithm
  • Digital Differential Analyser a scan conversion
    line algorithm
  • Based on calculating the rate of change of x or y
    coordinates (Dx or Dy respectively)
  • Given two endpoints
  • Step for the larger of length(x) or length(y)
  • Starting at first endpoint increment by Dx or Dy
    rounding off to the nearest pixel coordinate.

4
void lineDDA (int xa, int ya, int xa, int xb)
int dx xb - xa, dy yb - ya, steps, k float
xIncr, yIncr, x xa, y ya if (
abs(dx)gtabs(dy) ) steps abs(dx) else steps
abs(dy) xIncr dx / (float) steps yIncr
dy / (float) steps drawPixel ( ROUND(x),
ROUND(y) ) for (k0 kltsteps k) x
xIncr y yIncr drawPixel(
ROUND(x), ROUND(y) )
5
Antialiasing
  • Distortion of information due to low-frequency
    sampling
  • In raster images leads to jagged edges with
    staircase effect
  • We can reduce effects by antialiasing methods to
    compensate for undersampling

6
Antialiasing by supersampling
7
(No Transcript)
Write a Comment
User Comments (0)
About PowerShow.com