Esempio n. 1
0
cpSpatialIndexInit(cpSpatialIndex *index, cpSpatialIndexClass klass, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex)
{
	index.klass = klass;
	index.bbfunc = bbfunc;
	index.staticIndex = staticIndex;
	
	if(staticIndex){
		// cpAssertHard(!staticIndex.dynamicIndex, "This static index is already associated with a dynamic index.");
		staticIndex.dynamicIndex = index;
	}
	
	return index;
}
Esempio n. 2
0
cpSpaceHashNew(double celldim, int cells, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex)
{
	return cpSpaceHashInit(cpSpaceHashAlloc(), celldim, cells, bbfunc, staticIndex);
}
Esempio n. 3
0
cpSpaceHashInit(cpSpaceHash *hash, double celldim, int numcells, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex)
{
	cpSpatialIndexInit((cpSpatialIndex *)hash, Klass(), bbfunc, staticIndex);
	
	cpSpaceHashAllocTable(hash, next_prime(numcells));
	hash.celldim = celldim;
	
	hash.handleSet = cpHashSetNew(0, (cpHashSetEqlFunc)handleSetEql);
	
	hash.pooledHandles = cpArrayNew(0);
	
	hash.pooledBins = null;
	hash.allocatedBuffers = cpArrayNew(0);
	
	hash.stamp = 1;
	
	return (cpSpatialIndex *)hash;
}