- cpSpatialIndexContains
cpBool cpSpatialIndexContains(cpSpatialIndex* index, void* obj, cpHashValue hashid)
Returns true if the spatial index contains the given object.
Most spatial indexes use hashed storage, so you must provide a hash value too.
- cpSpatialIndexCount
int cpSpatialIndexCount(cpSpatialIndex* index)
Get the number of objects in the spatial index.
- cpSpatialIndexEach
void cpSpatialIndexEach(cpSpatialIndex* index, cpSpatialIndexIteratorFunc func, void* data)
Iterate the objects in the spatial index. @c func will be called once for each object.
- cpSpatialIndexInsert
void cpSpatialIndexInsert(cpSpatialIndex* index, void* obj, cpHashValue hashid)
Add an object to a spatial index.
Most spatial indexes use hashed storage, so you must provide a hash value too.
- cpSpatialIndexQuery
void cpSpatialIndexQuery(cpSpatialIndex* index, void* obj, cpBB bb, cpSpatialIndexQueryFunc func, void* data)
Perform a rectangle query against the spatial index, calling @c func for each potential match.
- cpSpatialIndexReindex
void cpSpatialIndexReindex(cpSpatialIndex* index)
Perform a full reindex of a spatial index.
- cpSpatialIndexReindexObject
void cpSpatialIndexReindexObject(cpSpatialIndex* index, void* obj, cpHashValue hashid)
Reindex a single object in the spatial index.
- cpSpatialIndexReindexQuery
void cpSpatialIndexReindexQuery(cpSpatialIndex* index, cpSpatialIndexQueryFunc func, void* data)
Simultaneously reindex and find all colliding objects.
@c func will be called once for each potentially overlapping pair of objects found.
If the spatial index was initialized with a static index, it will collide it's objects against that as well.
- cpSpatialIndexRemove
void cpSpatialIndexRemove(cpSpatialIndex* index, void* obj, cpHashValue hashid)
Remove an object from a spatial index.
Most spatial indexes use hashed storage, so you must provide a hash value too.
- cpSpatialIndexSegmentQuery
void cpSpatialIndexSegmentQuery(cpSpatialIndex* index, void* obj, cpVect a, cpVect b, cpFloat t_exit, cpSpatialIndexSegmentQueryFunc func, void* data)
Perform a segment query against the spatial index, calling @c func for each potential match.