本文整理汇总了C++中Pairs::GetPair方法的典型用法代码示例。如果您正苦于以下问题:C++ Pairs::GetPair方法的具体用法?C++ Pairs::GetPair怎么用?C++ Pairs::GetPair使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pairs
的用法示例。
在下文中一共展示了Pairs::GetPair方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: collide
void dxSAPSpace::collide (void *data, dNearCallback *callback)
{
dAASSERT (callback);
lock_count++;
cleanGeoms();
// by now all geoms are in GeomList, and DirtyList must be empty
int geomSize = GeomList.size();
dUASSERT( geomSize == count, "geom counts messed up" );
// separate all geoms into infinite AABBs and normal AABBs
TmpGeomList.setSize(0);
TmpInfGeomList.setSize(0);
int axis0max = SortAxes.mAxis0*2+1;
for( int i = 0; i < geomSize; ++i ) {
dxGeom* g =GeomList[i];
if( !GEOM_ENABLED(g) ) // skip disabled ones
continue;
const dReal& amax = g->aabb[axis0max];
if( amax == dInfinity ) // HACK? probably not...
TmpInfGeomList.push( g );
else
TmpGeomList.push( g );
}
// do SAP on normal AABBs
Pairs overlapBoxes;
bool isok = complete_box_pruning( TmpGeomList.size(), (const dxGeom**)TmpGeomList.data(), overlapBoxes, SortAxes );
// collide overlapping
udword overlapCount = overlapBoxes.GetNbPairs();
for( udword j = 0; j < overlapCount; ++j ) {
const Pair* pair = overlapBoxes.GetPair(j);
dxGeom* g1 = TmpGeomList[pair->id0];
dxGeom* g2 = TmpGeomList[pair->id1];
collideGeomsNoAABBs( g1, g2, data, callback );
}
int infSize = TmpInfGeomList.size();
int normSize = TmpGeomList.size();
int m, n;
for( m = 0; m < infSize; ++m ) {
dxGeom* g1 = TmpInfGeomList[m];
// collide infinite ones
for( n = m+1; n < infSize; ++n ) {
dxGeom* g2 = TmpInfGeomList[n];
collideGeomsNoAABBs( g1, g2, data, callback );
}
// collide infinite ones with normal ones
for( n = 0; n < normSize; ++n ) {
dxGeom* g2 = TmpGeomList[n];
collideGeomsNoAABBs( g1, g2, data, callback );
}
}
lock_count--;
}