/*! \brief 递归逐维分组碰撞算法 当分组到达最小组数量的时候,将最小组作为参数调用 SBC::SimpleColl \param group 参与碰撞检测的BOX组 \param fData 帧数据指针 \param minGroupSize 最小分组 \param freeBlockList 空闲块链表 \param axis1 当前检测的坐标轴 \param axis2 下个递归检测的坐标轴 */ void RDCColl(LIST<BOX*> &group, const FRAMEDATA *fData, size_t minGroupSize, BUFFER *freeBlockList, AXIS axis1, AXIS axis2) { if(axis1 == AXIS_INVALID || group.SizeIfLessThan(minGroupSize)) { SimpleColl(group, fData); } else { LIST<OPENCLOSEBOUNDARY> openCloseBoundaryList(&freeBlockList->m_collInfoBuffer); _FindOpenCloseBoundaryList(axis1, group, openCloseBoundaryList); LIST<BOX*> subGroup(group.GetFreeBlockList()); unsigned int count = 0; AXIS newAxis1 = axis2; AXIS newAxis2 = AXIS_INVALID; bool groupSubdivided = false; OPENCLOSEBOUNDARY *thisBoundaryPtr; for(LIST<OPENCLOSEBOUNDARY>::NOTE *thisNote = openCloseBoundaryList.QSort(); thisNote; thisNote = thisNote->GetNext()) { thisBoundaryPtr = &thisNote->Get(); if(thisBoundaryPtr->type == TYPE_OPEN) { ++count; subGroup.Create(thisBoundaryPtr->pBox); } else { --count; if(count == 0) { if(thisNote != openCloseBoundaryList.GetLast()) { groupSubdivided = true; } if(groupSubdivided) { if(newAxis1 == AXIS_X) { newAxis1 = AXIS_Y; newAxis2 = AXIS_X; } if(newAxis1 == AXIS_Y) { newAxis1 = AXIS_X; newAxis2 = AXIS_Y; } } RDCColl(subGroup, fData, minGroupSize, freeBlockList, newAxis1, newAxis2); subGroup.Clear(); } } } // for loop - end } // if - end } // RDCColl - end