コード例 #1
0
cpSpatialIndexFree(cpSpatialIndex *index)
{
	if(index){
		cpSpatialIndexDestroy(index);
		cpfree(index);
	}
}
コード例 #2
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;
}
コード例 #3
0
cpSpaceHashNew(double celldim, int cells, cpSpatialIndexBBFunc bbfunc, cpSpatialIndex *staticIndex)
{
	return cpSpaceHashInit(cpSpaceHashAlloc(), celldim, cells, bbfunc, staticIndex);
}
コード例 #4
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;
}