s2js
    Preparing search index...

    Class Coverer

    Index

    Constructors

    • Returns a new Coverer.

      Parameters

      • minLevel: number
      • maxLevel: number
      • levelMod: number
      • maxCells: number

      Returns Coverer

    Other

    interiorCovering: boolean = false
    levelMod: number
    maxCells: number
    maxLevel: number
    minLevel: number
    pq: PriorityQueue = ...
    region: Region = ...
    result: CellUnion = ...
    • 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.

      Parameters

      • cand: Candidate | NilCandidate

      Returns void

    • 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.

      Parameters

      Returns void

    • Returns the reduced "level" so that it satisfies levelMod. Levels smaller than minLevel are not affected (since cells at these levels are eventually expanded).

      Parameters

      • level: number

      Returns number

    • 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).

      Parameters

      Returns void

    • 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".

      Parameters

      • cand: Candidate
      • cell: Cell
      • numLevels: number

      Returns number

    • 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.

      Parameters

      Returns Candidate | NilCandidate

    • 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.

      Parameters

      Returns void

    • Replaces all descendants of the given id in covering with id. This requires the covering contains at least one descendant of id.

      Parameters

      • covering: bigint[]
      • id: bigint

      Returns bigint[]