























































Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
This page cannot be seen from the preview
Don't miss anything!
























































Filled Area Primitives
There are two basic approaches to area filling on raster systems.
scan-line polygon filling
Boundary-fill and Flood-fill
Polygon types
Does a straight line connecting ANY two points that are inside the polygon intersect any edges of the polygon?
Convex polygons
If the answer is no then polygon is convex
Complex polygons
Complex polygons are basically concave polygons that may have self-intersecting edges
Unfilled polygons
When an unfilled polygon is rendered, only the points on the perimeter of the polygon are drawn.
Parity
Parity is a concept used to determine which pixels lie within a polygon, i.e. which pixels should be filled for a given polygon.
ODD number of edges
Point is inside the polygon filled area
Even number of edges II
Point lies outside the circle
Polygon Filling Algorithm
When filling a polygon, you will most likely just have a set of vertices, indicating the x and y Cartesian coordinates of each vertex of the polygon. The following steps should be taken to turn your set of vertices into a filled polygon.
For each edge, the following information needs to be kept in a table:
Cont…
The slope of the edge can be calculated from the formula for a line y = mx + b
N 10 16 28 0
**- - - -
1 16 20 10 1.
0 10 16 10 0
Index Y-min Y-max X-val 1/m
Edges with the same minimum y values are sorted on minimum x values as follows: