spatial_data_structure¶
- class SpatialDataStructure¶
An abstract class used to implement some kind of spatial querying accelleration, such as a spatial hash-map or quadtree.
- abstract 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.
- abstract clear() None¶
Deletes all entries in the structure.
- abstract 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.
- abstract get_in_aabb( ) list[SpatialLike]¶
Get all the entities whose
collision_setoverlaps an AABB.
- abstract get_in_radius( ) list[SpatialLike]¶
Get all the entities whose
collision_setoverlaps a circle.
- abstract get_on_point( ) list[SpatialLike]¶
Get all the entities whose
collision_setoverlaps a point.
- abstract remove(item: SpatialLike) None¶
Remove the
SpatialLikeinstance from theSpatialHashMap.- Parameters:
- item: SpatialLike¶
The object to remove.
- abstract validate_insert(
- item: SpatialLike,
- merge: bool,
Checks to see if the added object overlaps any other objects currently contained within the map, and issues errors or warnings correspondingly.