A number of geometrical functions to manipulate line segments and polygons are provided. Most of these are derived from articles presented in the "Graphic Gems" books.
In the following function names, a line is an infinite line going through 2 points while a segment is the portion of that line limited by the 2 points.