We want to record occupancy in various bands. In general we need to consider seven (7) situations:
(1) (2) (3) (4) \ / \ / \ / __\_____/_____\_________/_____\_________/______ Upper Limit \ / \ / \ / / \ \-->--/ \--<--/ /-----\ v ^ / \(7) \ \ \ / \ \ /--<--\ /-->--\ \-----/ ____\______\____/_______\____/_______\_________ Lower Limit \ \ / \ / \ (5) (6)
We know that following "next" pointers around an outline keeps the black area on the LEFT. We only need be concerned with situations 1,2,3,5 and 7. 4 and 6 can be ignored as they represent small incursions into a large black region which will be recorded elsewhere. Situations 3 and 5 define enclosed areas bounded by the upper and lower limits respectively. Situation 1 is open to the right, awaiting a closure by a situation 2 which is open to the right. Situation 7 is entirely enclosed within the band.
The situations are refered to as region types and are determined by find_region_type.
An empty region type is used to denote entry to an adjacent band and return to the original band at the same x location.
See blkocc.cpp