Adds the given candidate to the result if it is marked as "terminal", otherwise expands its children and inserts it into the priority queue. Passing an argument of nil does nothing.
Ensures that all cells with level > minLevel also satisfy levelMod, by replacing them with an ancestor if necessary. Cell levels smaller than minLevel are not modified (see AdjustLevel). The output is then normalized to ensure that no redundant cells are present.
Returns the reduced "level" so that it satisfies levelMod. Levels smaller than minLevel are not affected (since cells at these levels are eventually expanded).
Generates a covering and stores it in result. Strategy: Start with the 6 faces of the cube. Discard any that do not intersect the shape. Then repeatedly choose the largest cell that intersects the shape and subdivide it.
result contains the cells that will be part of the output, while pq contains cells that we may still subdivide further. Cells that are entirely contained within the region are immediately added to the output, while cells that do not intersect the region are immediately discarded. Therefore pq only contains cells that partially intersect the region. Candidates are prioritized first according to cell size (larger cells first), then by the number of intersecting children they have (fewest children first), and then by the number of fully contained children (fewest children first).
Populates the children of the candidate by expanding the given number of levels from the given cell. Returns the number of children that were marked "terminal".
Computes a set of initial candidates that cover the given region.
Returns a new candidate with no children if the cell intersects the given region. The candidate is marked as terminal if it should not be expanded further.
Normalizes the "covering" so that it conforms to the current covering parameters (maxCells, minLevel, MaxLevel, and levelMod). This method makes no attempt to be optimal. In particular, if minLevel > 0 or levelMod > 1 then it may return more than the desired number of cells even when this isn't necessary.
Note that when the covering parameters have their default values, almost all of the code in this function is skipped.
Replaces all descendants of the given id in covering with id. This requires the covering contains at least one descendant of id.
Returns a new Coverer.