Polygons are a very useful graphical tool. Solid three dimensional shapes can easily be approximated with a few polygons, and, when good shading and texturing are applied, they can look resonably realistic. They can be drawn quickly and take up very little storage space.
A polygon is an enclosed area bounded by at least three sides. There are three types of polygon, all of which need different drawing routines to handle.
Concave Polygon: Concave polygons go back on themselves. They can contain inlets and fjords. They all have at least 4 sides.
Complex Polygon: These are all the rest. They can do anything. They can have holes, they can cross themselves, as many times as they like.
A polygon can be defined by a set of points or a set of line segments. The order in which the
set of points is listed is important. Different orders mean different polygons. These two polygons
are made ou from the same set of points, listed in a different order.
For a vertex whose two edges go in opposite directions, one up, one down, count the vertex as
one crossing. Vertices whose edges go in the same direction, both up or both down, count the vertex
as two crossings.
In three dimensions, polygons have two sides, a back and a front. This is a very important thing to consider when writing a rendering engine. Imagine closed solid made from polygons. Only one side of each polygon will ever be visible. There is no point wasting time drawing the surfaces facing away from you, as you will not be able to see them. It is worth taking a little time to decide which polygons are facing away and ignoring them. It will save about half the rendering time.