Understanding Raster Displays & Bresenham's Line Algorithm: Pixel & Polygon Filling, Study notes of Computer Graphics

This document delves into the fundamentals of raster displays, focusing on bresenham's line algorithm. Topics include display refresh, memory elements, phosphors, and addressing timing. The text also covers strategies for filling polygons, such as sweep fill, and discusses ambiguous cases for determining if a pixel is inside a polygon.

Typology: Study notes

Pre 2010

Uploaded on 03/16/2009

koofers-user-49t-1
koofers-user-49t-1 🇺🇸

9 documents

1 / 7

Toggle sidebar

This page cannot be seen from the preview

Don't miss anything!

bg1
Raster displays = refresh
by scanning from top to
bottom in left right order.
Use timing to construct a
correspondence between
memory elements and
screen elements.
Typical numbers:
1280 by 1024 points
75 refreshes per second
May have many phosphor
dots corresponding to one
memory element.
Memory elements called
pixels
Size of memory elements
determines number of
possible colours in one
display
Refresh rate generates
architectural issues.
Displays
Chapter 3
Phosphors
Positively
charged
grid
Deflection
coils
Light
Timing
Frame
Buffer
D/A converter
CRT
Addressing
Timing
Electron
Gun Intensity
01 2 3
0
1
2
3
(2, 1)
pf3
pf4
pf5

Partial preview of the text

Download Understanding Raster Displays & Bresenham's Line Algorithm: Pixel & Polygon Filling and more Study notes Computer Graphics in PDF only on Docsity!

  • Raster displays = refresh by scanning from top to
  • bottom in left right orderUse timing to construct a. correspondence between memory elements and
  • screen elements.Typical numbers:
    • – 1280 by 1024 points75 refreshes per second
      • May have many phosphor dots corresponding to one
      • memory element.Memory elements called
      • pixelsSize of memory elements determines number of possible colours in one
      • displayRefresh rate generates architectural issues.

Displays

Chapter 3 Phosphors Positively charged grid Deflection coils

Light

Timing

Frame Buffer

D/A converter

Addressing CRT Timing

El Gun Intensitectron y^0 1 2

Displaying lines

  • Assume: – lines have integer vertices
    • lines all lie within the displayable region of the
  • Other algorithms will take^ frame buffer
  • care of this.consider lines of the form y=m x + c, where 0<m< - all others follow by symmetry - V – ariety of silly algorithms: step x, compute new y at each step by equation, rounding
  • step x, compute new y at each step by adding m to old y, rounding

x x+

y

y+

Actua line y=ml point x + b on

d d

Bresenham’s algorithm

  • plot the pixel whose y- value is closest to the line
  • given (x from either (xk, yk), must choosek+1, yk+1) or
  • (xidea: compute value thatk+1, yk) will determine this choice, and is easy to update.

What is inside - 1?

  • Easy for simple polygons - no self intersections
  • for general polygons, three rules are possible:
    • – non-exterior rulenon-zero winding number
    • ruleparity rule Polygon

parity non-zero winding no.

non- exterior

What is inside - 2?

  • Each pixel is a coordinates (x, y). sample, at
    • imagine a piece of paper where coordinates are ,
    • continuouspixels are samples on a grid of a drawing on this piece of paper.
  • If point is inside, pixel is inside.

Rules

• Ambiguous cases: – on edge? if (x+d, y) is in, pixel is in

  • Q: what if it’^ •^ on horizontal edge? if (x+d, y+e) is in, pixel is ins on a vertex?
    • a horizontal vertex?

Ambiguous inside cases (?) are not really ambiguous

Sweep fill

• Algorithmic issues: – reduce to filling many spans

  • – which edges define the span of pixels to fill?how do you update these edges when moving from span
  • to span?what happens when you cross a vertex?

Spans

  • Process - fill the bottom horizontal span of pixels; move
  • up and keep fillinghave xmin, xmax.
  • define: – floor(x):= if x integer, x else
    • truncate(x)ceiling(x):= truncate(x)+
  • fill from? up to but not including?
  • consistent with convention x

y

Filling in details

  • maintain – left edge
  • for each, must know: x-^ –^ right edge value, maximum y value of edge, 1/m
  • Keep edges in a table, indexed by minimum y value - Edge Table - For row = min to row=max - attach edges whose ymin=row - remove edges whose ymax=row - – fill spanupdate each edge

Comments

  • Sort is quite fast, because AEL is usually almost in
  • orderNot very efficient use of. cache - other approaches are increasingly popular
  • For example, OpenGL limits to convex polygons, meaning two and only two elements in AEL at any time, and no sorting. - with stack (to keep track of what colour to use), can fill in many polygons at a time. - can generate addresses efficiently here, too. - Does point - next slide not require floating

Dodging floating point

  • for edge, 1/m=Dx/Dy which is a rational ,
  • numberstore x as x_int, x_num,.
  • x_denom=Dythen x->x+1/m is given by: – x_num=x_num+Dx - if x_num >= x_denom • x_int=x_int+ - x_num=x_num-x_denom - Advantages: – no floating point - can tell if x is an integer or not (check x_num=0), and get truncate(x) easily the span endpoints. , for