GenericIndexedCloud* CloudSamplingTools::resampleCloudWithOctree( GenericIndexedCloudPersist* inputCloud, int newNumberOfPoints, RESAMPLING_CELL_METHOD resamplingMethod, GenericProgressCallback* progressCb, DgmOctree* inputOctree) { assert(inputCloud); DgmOctree* octree = inputOctree; if (!octree) { octree = new DgmOctree(inputCloud); if (octree->build(progressCb) < 1) return 0; } //look for the Octree level that gives the number of cells (= points) closest to the desired value unsigned char bestLevel = octree->findBestLevelForAGivenCellNumber(newNumberOfPoints); GenericIndexedCloud* sampledCloud = resampleCloudWithOctreeAtLevel(inputCloud, bestLevel, resamplingMethod, progressCb, octree); if (!inputOctree) delete octree; return sampledCloud; }
ReferenceCloud* CloudSamplingTools::subsampleCloudWithOctree( GenericIndexedCloudPersist* inputCloud, int newNumberOfPoints, SUBSAMPLING_CELL_METHOD subsamplingMethod, GenericProgressCallback* progressCb/*=0*/, DgmOctree* inputOctree/*=0*/) { assert(inputCloud); DgmOctree* octree = inputOctree; if (!octree) { octree = new DgmOctree(inputCloud); if (octree->build(progressCb) < 1) return 0; } //on cherche le niveau qui donne le nombre de points le plus proche de la consigne unsigned char bestLevel = octree->findBestLevelForAGivenCellNumber(newNumberOfPoints); ReferenceCloud* subsampledCloud = subsampleCloudWithOctreeAtLevel(inputCloud,bestLevel,subsamplingMethod,progressCb,octree); if (!inputOctree) delete octree; return subsampledCloud; }
GenericIndexedCloud* CloudSamplingTools::resampleCloudWithOctree(GenericIndexedCloudPersist* theCloud, int newNumberOfPoints, RESAMPLING_CELL_METHOD resamplingMethod, GenericProgressCallback* progressCb, DgmOctree* _theOctree) { assert(theCloud); DgmOctree* theOctree = _theOctree; if (!theOctree) { theOctree = new DgmOctree(theCloud); if (theOctree->build(progressCb) < 1) return 0; } //on cherche le niveau qui donne le nombre de points le plus proche de la consigne uchar bestLevel=theOctree->findBestLevelForAGivenCellNumber(newNumberOfPoints); GenericIndexedCloud* sampledCloud = resampleCloudWithOctreeAtLevel(theCloud,bestLevel,resamplingMethod,progressCb,theOctree); if (!_theOctree) delete theOctree; return sampledCloud; }