spatial_hashmap¶
-
class SpatialHashMap(cell_size: int =
4)¶ Implementation of a
SpatialDataStructureusing a hash-map. Accellerates spatial queries ofCollection.- add(
- item: SpatialLike,
- merge: bool =
False, Add a
SpatialLikeinstance to theSpatialDataStructure.- Parameters:
- item: SpatialLike¶
The object to add.
- merge: bool =
False¶ Whether or not to attempt to merge the added item with any existing item, if possible.
- Returns:
The input SpatialLike if properly added, or
Noneif the input object was merged.
- clear() None¶
Deletes all entries in the structure.
- get_all() list[SpatialLike]¶
Get all the entities in the hash map. Iterates over every cell and returns the contents sequentially. Useful if you want to get all the Entities in a Blueprint without including structural ones like Groups.
- Returns:
A
listof all entities inside the hash map.
- get_in_aabb( ) list[SpatialLike]¶
Get all the entities whose
collision_setoverlaps an AABB.
- get_in_radius( ) list[SpatialLike]¶
Get all the entities whose
collision_setoverlaps a circle.
- get_on_point( ) list[SpatialLike]¶
Get all the entities whose
collision_setoverlaps a point.
- remove(item: SpatialLike) None¶
Remove the
SpatialLikeinstance from theSpatialHashMap.- Parameters:
- item: SpatialLike¶
The object to remove.
- validate_insert(
- item: SpatialLike,
- merge: bool,
Issues OverlappingObjectWarnings if adding this particular
itemwould be unplacable in the current blueprint/group configuration.