The Bool library was initially developed for use in microelectronic mask making and layout software. It is integer based and uses 4 byte signed integers for the coordinate data -- thus limiting the max and min coordinate values to 2,147,483,647. To convert from real world units (such as um or mil) one defines a database tick and the number of database ticks per real world unit.
There are two basic entity types supported - polygons and paths.
Polygons are represented by an array of X,Y coordinate pairs (note that the first and last coordinate of each polygon are the same point so it requires 5 pairs to define a rectangle). Paths are represented by an array of X,Y coordinate pairs along with a width and and an end-cap definition.
When processing multiple polygons one uses an array of arrays.
Bool also supports the Leonov polygon description - this consists of a parent polygon followed by one or more children that represent holes within the parent.
Initialization & Cleanup
Example 1 - A Simple Two Polygon Example
Two polygons are booleanized (choice of OR, DIFF, XOR, AND) and these polygons and the result are written as a DXF file.