Computer Graphics
Graphic Systems
Input-Output Devices
Scan Conversion a line
Scan Conversion Circle
Scan Converting Ellipse
Filled Area Primitives
2D Transformations
2D-Viewing
Clipping Techniques
Pointing & Positioning
3D Computer Graphics
Hidden Surfaces
Projection
Programs
Scan Line Algorithm
It is an image space algorithm. It processes one line at a time rather than one pixel at a time. It uses the concept area of coherence. This algorithm records edge list, active edge list. So accurate bookkeeping is necessary. The edge list or edge table contains the coordinate of two endpoints. Active Edge List (AEL) contain edges a given scan line intersects during its sweep. The active edge list (AEL) should be sorted in increasing order of x. The AEL is dynamic, growing and shrinking.
Following figures shown edges and active edge list. The active edge list for scan line AC1contain e1,e2,e5,e6 edges. The active edge list for scan line AC2contain e5,e6,e1.
Scan line can deal with multiple surfaces. As each scan line is processed, this line will intersect many surfaces. The intersecting line will determine which surface is visible. Depth calculation for each surface is done. The surface rear to view plane is defined. When the visibility of a surface is determined, then intensity value is entered into refresh buffer.
Algorithm
Step1: Start algorithm
Step2: Initialize the desired data structure
- Create a polygon table having color, edge pointers, coefficients
- Establish edge table contains information regarding, the endpoint of edges, pointer to polygon, inverse slope.
- Create Active edge list. This will be sorted in increasing order of x.
- Create a flag F. It will have two values either on or off.
Step3: Perform the following steps for all scan lines
- Enter values in Active edge list (AEL) in sorted order using y as value
- Scan until the flag, i.e. F is on using a background color
- When one polygon flag is on, and this is for surface S1enter color intensity as I1into refresh buffer
- When two or image surface flag are on, sort the surfaces according to depth and use intensity value Sn for the nth surface. This surface will have least z depth value
- Use the concept of coherence for remaining planes.
Step4: Stop Algorithm