Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: a line F(x,y) = ax + by + c = 0. If b < 0, F > 0 if the line is above the point F < 0 if the line is below the point Summary of mid-point algorithm ● ● ● ● Start point is simply first endpoint (xl,yl). Calculate the initial value for d Choose between 2 pixels at each step based upon the sign of a decision variable. Update the decision variable based upon which pixel is chosen. ●No floating point arithmetic needed Midpoint algorithm void MidpointLine(int x1,y1,x2,y2) { int dx=x2-x1; int dy=y2-y1; int d=2*dy-dx; int increE=2*dy; int incrNE=2*(dy-dx); x=x1; y=y1; WritePixel(x,y); while (x < x2) { if (d<= 0) { d+=incrE; x++ } else { d+=incrNE; x++; y++; } WritePixel(x,y); } } * Overview Rasterization •Line Rasterization •Polygon Rasterization ●Scanline Algorithm ●Rasterizing triangles Edge walking ●Interpolation by barycentric coordinates ● •Mean value coordinates •Dividing polygons into triangles Scanline algorithm A traditional approach of rasterization Filling in the pixels within the polygon along the scan line Scanline algorithm For each scan line: 1.Find the intersections of the scan   line with all edges of th...
View Full Document

This document was uploaded on 03/26/2014.

Ask a homework question - tutors are online