s2js
    Preparing search index...

    Class ShapeIndex

    Index

    Constructors

    Other

    cellMap: Map<bigint, ShapeIndexCell>
    cells: bigint[]
    maxEdgesPerCell: number
    nextID: number
    pendingAdditionsPos: number
    pendingRemovals: RemovedShape[]
    shapes: Map<number, Shape>
    status: number
    • Absorbs an index cell by transferring its contents to edges and/or "tracker", and then delete this cell from the index. If edges includes any edges that are being removed, this method also updates their InteriorTracker state to correspond to the exit vertex of this cell.

      Parameters

      • p: PaddedCell
      • iter: ShapeIndexIterator
      • edges: ClippedEdge[]
      • t: ShapeIndexTracker

      Returns void

    • Adds the given faceEdge into the collection of all edges.

      Parameters

      • _fe: FaceEdge
      • allEdges: FaceEdge[][]

      Returns void

    • Clips all edges of the given shape to the six cube faces, adds the clipped edges to the set of allEdges, and starts tracking its interior if necessary.

      Parameters

      • shapeID: number
      • allEdges: FaceEdge[][]
      • t: ShapeIndexTracker

      Returns void

    • Does the actual work of updating the index by applying all pending additions and removals. It does not update the indexes status.

      Returns void

    • Triggers the update of the index. Calls to Add and Release are normally queued and processed on the first subsequent query. This has many advantages, the most important of which is that sometimes there is no subsequent query, which lets us avoid building the index completely.

      This method forces any pending updates to be applied immediately.

      Returns void

    • Clips the given endpoint (lo=0, hi=1) of the u-axis so that it does not extend past the given value of the given edge.

      Parameters

      • edge: ClippedEdge
      • uEnd: number
      • u: number

      Returns ClippedEdge

    • Returns the given edge clipped to within the boundaries of the middle interval along the v-axis, and adds the result to its children.

      Parameters

      Returns [ClippedEdge?, ClippedEdge?]

    • Clips the given endpoint (lo=0, hi=1) of the v-axis so that it does not extend past the given value of the given edge.

      Parameters

      • edge: ClippedEdge
      • vEnd: number
      • v: number

      Returns ClippedEdge

    • Reports the number of distinct shapes that are either associated with the given edges, or that are currently stored in the InteriorTracker.

      Parameters

      • edges: ClippedEdge[]
      • shapeIDs: number[]

      Returns number

    • Returns the id of the given shape in this index, or -1 if it is not in the index.

      Parameters

      • shape: Shape

      Returns number

    • Reports if there are no pending updates that need to be applied. This can be useful to avoid building the index unnecessarily, or for choosing between two different algorithms depending on whether the index is available.

      The returned index status may be slightly out of date if the index was built in a different thread. This is fine for the intended use (as an efficiency hint), but it should not be used by internal methods.

      Returns boolean

    • Reports if the shape with the given ID is currently slated for removal.

      Parameters

      • shapeID: number

      Returns boolean

    • Builds an indexCell from the given padded cell and set of edges and adds it to the index. If the cell or edges are empty, no cell is added.

      Parameters

      • p: PaddedCell
      • edges: ClippedEdge[]
      • t: ShapeIndexTracker

      Returns boolean

    • Returns the number of edges in the given index, up to the given limit. If the limit is encountered, the current running total is returned, which may be more than the limit.

      Parameters

      • limit: number

      Returns number

    • Does the actual work for removing a given shape from the index.

      Parameters

      • _removed: RemovedShape
      • _allEdges: FaceEdge[][]
      • _t: ShapeIndexTracker

      Returns void

    • Returns the shape with the given ID, or undefined if the shape has been removed from the index.

      Parameters

      • id: number

      Returns Shape | NilShape

    • Skips over the cells in the given range, creating index cells if we are currently in the interior of at least one shape.

      Parameters

      • begin: bigint
      • end: bigint
      • t: ShapeIndexTracker
      • disjointFromIndex: boolean

      Returns void

    • Calls the trackers testEdge on all edges from shapes that have interiors.

      Parameters

      • edges: ClippedEdge[]
      • t: ShapeIndexTracker

      Returns void

    • Updates the specified endpoint of the given clipped edge and returns the resulting clipped edge.

      Parameters

      • edge: ClippedEdge
      • uEnd: number
      • u: number
      • vEnd: number
      • v: number

      Returns ClippedEdge

    • Adds or removes the given edges whose bounding boxes intersect a given cell. disjointFromIndex is an optimization hint indicating that cellMap does not contain any entries that overlap the given cell.

      Parameters

      • pcell: PaddedCell
      • edges: ClippedEdge[]
      • t: ShapeIndexTracker
      • disjointFromIndex: boolean

      Returns void

    • Adds or removes the various edges from the index. An edge is added if shapes[id] is not null, and removed otherwise.

      Parameters

      • face: number
      • faceEdges: FaceEdge[]
      • t: ShapeIndexTracker

      Returns void