public sealed class SurfaceCardIndexWhich cards could contain a point — the spatial index the linear scan was the baseline for.
No guide page documents this yet — the page shows what the code says about itself.
Remarks
A uniform grid of card lists, and a query is one cell. A card registers into every cell its box overlaps, so any card whose box contains a point necessarily overlaps the cell the point falls in — one dictionary lookup gives a superset of the containing cards, and the containment, depth and facing tests stay exactly where they were. The index narrows the scan; it never answers for it, which is what makes "the index agrees with the linear scan" a property a test can hold on random cards rather than an argument.
Candidates come back in the order the cards arrived. Cards are only ever appended, so every cell's list is ascending by index — and the sampling's tie-break (equal facing goes to the earlier card) survives the index without knowing it exists.
Fields and properties (2)
public float CellSizeHow wide a grid cell is, in world units.
public int RegistrationsHow many card registrations the grid holds, across all cells.
Methods (4)
public SurfaceCardIndex(float cellSize = 4)Builds an empty index.
public void Add(int card, SurfaceCard shape)Registers a card under every cell its box overlaps.
public ReadOnlySpan<int> Candidates(Vector3 position)The cards whose boxes could contain a point, ascending, possibly with false positives.
public void Clear()Forgets every card.
Used by (1)
- SurfaceCacheStoreVixen.Rendering.SurfaceCache