dchip.cpSpatialIndex

Members

Aliases

cpBBTreeVelocityFunc
alias cpBBTreeVelocityFunc = cpVect function(void* obj)

Bounding box tree velocity callback function. This function should return an estimate for the object's velocity.

cpSpatialIndexBBFunc
alias cpSpatialIndexBBFunc = cpBB function(void* obj)

Spatial indexes are data structures that are used to accelerate collision detection and spatial queries. Chipmunk provides a number of spatial index algorithms to pick from and they are programmed in a generic way so that you can use them for holding more than just cpShape structs.

cpSpatialIndexIteratorFunc
alias cpSpatialIndexIteratorFunc = void function(void* obj, void* data)

Spatial index/object iterator callback function type.

cpSpatialIndexQueryFunc
alias cpSpatialIndexQueryFunc = cpCollisionID function(void* obj1, void* obj2, cpCollisionID id, void* data)

Spatial query callback function type.

cpSpatialIndexSegmentQueryFunc
alias cpSpatialIndexSegmentQueryFunc = cpFloat function(void* obj1, void* obj2, void* data)

Spatial segment query callback function type.

Functions

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.

cpSpatialIndexDestroy
void cpSpatialIndexDestroy(cpSpatialIndex* index)

Destroy a 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.

cpSpatialIndexFree
void cpSpatialIndexFree(cpSpatialIndex* index)

Destroy and free a spatial index.

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.

Structs

cpSpatialIndex
struct cpSpatialIndex

Meta