bool CoverageRegion::mergeItemsInArray(VoxelProjectedPolygon* seed, bool seedInArray) { for (int i = 0; i < _polygonCount; i++) { VoxelProjectedPolygon* otherPolygon = _polygons[i]; if (otherPolygon->canMerge(*seed)) { otherPolygon->merge(*seed); if (seedInArray) { int* IGNORED_ADDRESS = NULL; // remove this otherOtherPolygon for our polygon array _polygonCount = removeFromSortedArrays((void*)seed, (void**)_polygons, _polygonDistances, IGNORED_ADDRESS, _polygonCount, _polygonArraySize); _totalPolygons--; } //qDebug("_polygonCount=%d\n",_polygonCount); // clean up if (_managePolygons) { delete seed; } // Now run again using our newly merged polygon as the seed mergeItemsInArray(otherPolygon, true); return true; } } return false; }