CSC 418 Computer Graphics n Display Technology n

  • Slides: 20
Download presentation
CSC 418 Computer Graphics n Display Technology n 2 D modeling primitive equations n

CSC 418 Computer Graphics n Display Technology n 2 D modeling primitive equations n Drawing lines

Raster Displays I V time Electron beam Intensity

Raster Displays I V time Electron beam Intensity

Raster Displays II Gamma correction V time Electron beam Intensity

Raster Displays II Gamma correction V time Electron beam Intensity

Raster Displays II Gamma correction

Raster Displays II Gamma correction

Raster Displays II Gamma correction

Raster Displays II Gamma correction

Display Architecture Frame Buffer

Display Architecture Frame Buffer

Display Architecture Double Buffer

Display Architecture Double Buffer

Display Architecture II True Color Frame Buffer : 8 bits per pixel RGB

Display Architecture II True Color Frame Buffer : 8 bits per pixel RGB

Display Architecture II Indexed Color Frame Buffer : 8 bit index to color map

Display Architecture II Indexed Color Frame Buffer : 8 bit index to color map

Display Devices II Plasma Immersive Holographic Head-mounted Volumetric

Display Devices II Plasma Immersive Holographic Head-mounted Volumetric

Line Drawing What is the best line we can draw?

Line Drawing What is the best line we can draw?

Line Drawing What is the best line we can draw? The best we can

Line Drawing What is the best line we can draw? The best we can do is a discrete approximation of an ideal line. Important line qualities: n Continuous appearence n Uniform thickness and brightness n Accuracy (Turn on the pixels nearest the ideal line) n Speed (How fast is the line generated)

Equation of a Line Explicit : y = mx + b Parametric : x(t)

Equation of a Line Explicit : y = mx + b Parametric : x(t) = x 0 + (x 1 – x 0)*t y(t) = y 0 + (y 1 – y 0)*t P = P 0 + (P 1 -P 0)*t P = P 0*(1 -t) + P 1*t (weighted sum) Implicit : (x-x 0)dy - (y-y 0)dx = 0

Algorithm I Explicit form: y= dy/dx * (x-x 0) + y 0 float y;

Algorithm I Explicit form: y= dy/dx * (x-x 0) + y 0 float y; int x; for ( x=x 0; x<=x 1; x++) { y= y 0 + (x-x 0)*(y 1 -y 0)/(x 1 -x 0); setpixel (x, round(y)); }

Algorithm I Explicit form: y= dy/dx * (x-x 0) + y 0 float y;

Algorithm I Explicit form: y= dy/dx * (x-x 0) + y 0 float y; int x; dx = x 1 -x 0; dy = y 1 – y 0; m = dy/dx; y= y 1 + 0. 5; for ( x=x 0; x<=x 1; x++) { setpixel (x, floor(y)); y= y + m; }

Algorithm I DDA (Digital Differential Analyzer) float y; int x; dx = x 1

Algorithm I DDA (Digital Differential Analyzer) float y; int x; dx = x 1 -x 0; dy = y 1 – y 0; m = dy/dx; y= y 1 + 0. 5; for ( x=x 0; x<=x 1; x++) { setpixel (x, floor(y)); y= y + m; }

Algorithm II Bresenham Algorithm n n n Assume |line slope <1 Slope is rational

Algorithm II Bresenham Algorithm n n n Assume |line slope <1 Slope is rational (ratio of two integers). m = (y 1 - y 0) / (x 1 - x 0) The incremental part of the algorthim never generates a new y that is more than one unit away from the old one (because the slope is always less than one) yi+1 = yi + m

Algorithm II Bresenham Algorithm Geometric Interpretation Distance of midpt from line = dy- ½*dx

Algorithm II Bresenham Algorithm Geometric Interpretation Distance of midpt from line = dy- ½*dx

Algorithm II Bresenham Algorithm Implicit View F(x, y) = (x-x 0)dy - (y-y 0)dx

Algorithm II Bresenham Algorithm Implicit View F(x, y) = (x-x 0)dy - (y-y 0)dx F(x+1, y + 0. 5) = F(x, y) + dy -0. 5 dx 2 F(x+1, y+ 0. 5) = d = 2 F(x, y) + 2 dy -dx F(x+1, y) = F(x, y) + dy F(x+1, y+1) = F(x, y) +dy-dx d’ = d + 2 dy - 2 dx

CSC 418 Computer Graphics Next Lecture…. n n Polygons – Triangulation – Scan conversion

CSC 418 Computer Graphics Next Lecture…. n n Polygons – Triangulation – Scan conversion – Convex/Concave – clipping) 2 D affine transformations and properties, Homogeneous coordinates