2011年10月18日 星期二

Principle of Computer Graphics - lecture notes3

Splines and Interpolation

Linear spline = draw lines from point to point
polynomial interpolation =

lagrange polynomial interpolation =
you can find a curve f(t) = summation from 1 to n (ait^i)
n control points => nth order derivative exists => smooth curve

Hermite Interpolation
given 2 control points,
V(0), V(1) and find V'(0) V'(1)

Catmull-Rom Spline
Cardinal Spline
Bezier Spline
Cubic B-spline

Principle of Computer Graphics - lecture notes2

Notes 2:
alpha channel = 1 - transparency = proportion of pixel occupied by some graphics
Digital image are stored in grids.
where 1 grid = 1 pixel
for each grid,
我們要考慮:
1. aspect ratio = width / height of the frame (ratio for 1 pixel
2. Resolution = width * height
3. Dynamic Range = ratio difference between max. and min. light intensity pixel

Each pixel is mapped to a memory cell (i.e.the pixel data is pointed by a pointer)

Frame buffer refresh is by following way (for CRT)
scan starts at the leftmost point from the rightmost point
Finishing one line, the e- gun points the starting point at the 2nd row(we call the intermmediate "Horizontal retrace)
Repeating the above process, after finishing the whole image, the e- gun points to the starting point
(Vertical retrace)
The Frequency of vertical retrace determines the refresh rate

Every image consists of RGB3 channels. To form an normal image, we pass 3 channels to DAC.

In the past, thanks to expensive memory, we store the color indirectly:
label each color by indexing. and we store the color by the index number. When extracting the color, we pass the color index and we lookup the corresponding RGB value in a color lookup table.

==============================
Rasterization = find discrete algorithm for continuous geometric concepts

Line Drawing
Parametric forms of a line
1.
x = x1+t
y = y1+mt

what if slope = infinity???
slope = 0???

guaranteed parametric form
x = x0 + t(x1-x0)
y = y0 + t(y1-y0)

Digital Differential Analyzer = draw discrete line
1. find parametric form
2. draw line by rounding of the co.

Rasterization = convert geometry in device co.to fragments in screen
Triangle rasterization = divide the polygons into triangle and fill them up with colors
Be familiar with
Trangle fill Procedure:
given 3 points (xi,yi) on the screen( xi^ with i)
calculate the starting and ending points for each line
fill the intermediate points

OR
express 3 eqt in general form and let them be the bounding condition for fillings.


Area Scan Conversion:
Flood fill (input: one color, filling color)
Boundary fill (input: boundary, color)
8 connected = middle grid in 9 grids
4 connected = up,down,left,right (regular direction)
Scanline fill = above triangle fill procedure