void nodeManager::addToCollisionRegions(ofPtr<clamourNode> n) { ofRectangle r = n->getBounds(); float nFar_x = r.x + r.width; float nFar_y = r.y + r.height; vector <ofRectangle> :: iterator it = mCollisionMapBounds.begin(); int t_count = 0; while(it != mCollisionMapBounds.end()) { float tFar_x = it->x + it->width; float tFar_y = it->y + it->height; if( ( it->inside(ofPoint(r.x,r.y)) || it->inside(ofPoint(r.x,nFar_y)) || it->inside(ofPoint(nFar_x,r.y)) || it->inside(ofPoint(nFar_x,nFar_y)) ) || ( ((it->x >= r.x && it->x <= nFar_x) || ( tFar_x <= nFar_x && tFar_x >= r.x) ) && ((it->y >= r.y && it->y <= nFar_y) || ( tFar_y <= nFar_y && tFar_y >= r.y) ) ) ) { mCollisionMap[t_count].push_back(n); } t_count ++; ++it; } }