Bounding box query
Posted: Sun Feb 14, 2010 9:05 am
Hi,
I've been using cpSpaceBBQuery, I noticed that when I placed my shapes in a given group, 1 for example I got returned every other group apart from the one I specified. I believe the bug is in the code below, I think !(shape->group) should be exclusive of the (context->group == shape->group)
becomes
Cheers
Rich
I've been using cpSpaceBBQuery, I noticed that when I placed my shapes in a given group, 1 for example I got returned every other group apart from the one I specified. I believe the bug is in the code below, I think !(shape->group) should be exclusive of the (context->group == shape->group)
Code: Select all
static void
bbQueryHelper(cpBB *bb, cpShape *shape, bbQueryContext *context)
{
if(
!(shape->group && context->group == shape->group) && (context->layers&shape->layers) &&
cpBBintersects(*bb, shape->bb)
){
context->func(shape, context->data);
}
}
becomes
Code: Select all
static void
bbQueryHelper(cpBB *bb, cpShape *shape, bbQueryContext *context)
{
if(
!(shape->group) && (context->group == shape->group) && (context->layers&shape->layers) &&
cpBBintersects(*bb, shape->bb)
){
context->func(shape, context->data);
}
}
Rich