SpatialPositionIndex<T> class

High-performance spatial index using grid-based partitioning for collision detection.

This class implements an optimized spatial indexing system that partitions space into a regular grid to enable fast collision detection between map elements. It provides O(1) insertion and O(log n) collision detection performance.

Key features:

  • Grid-based spatial partitioning for performance
  • Configurable cell size for different use cases
  • Fast collision detection with boundary checking
  • Memory-efficient storage with sparse grid representation
  • Exception handling for robust collision detection

Constructors

SpatialPositionIndex({double cellSize = 256.0})
Creates a new spatial index with the specified cell size.

Properties

hashCode int
The hash code for this object.
no setterinherited
runtimeType Type
A representation of the runtime type of the object.
no setterinherited

Methods

add(T item, Mappoint position) → void
Adds a render item to the spatial index.
clear() → void
Clear the spatial index
getGrid() Map<String, List<T>>
getStats() Map<String, dynamic>
Get statistics about the spatial index
noSuchMethod(Invocation invocation) → dynamic
Invoked when a nonexistent method or property is accessed.
inherited
toString() String
A string representation of this object.
inherited

Operators

operator ==(Object other) bool
The equality operator.
inherited