![]() |
ACloudViewer
3.9.4
A Modern Library for 3D Data Processing
|
#include <ecvOctree.h>


Classes | |
| struct | BestRadiusParams |
| Parameters for the GuessBestRadius method. More... | |
Public Types | |
| enum | DisplayMode { WIRE = 0 , MEAN_POINTS , MEAN_CUBES = 2 } |
| Octree displaying methods. More... | |
| typedef QSharedPointer< ccOctree > | Shared |
| Shared pointer. More... | |
Public Types inherited from cloudViewer::DgmOctree | |
| enum | RayCastProcess { RC_NEAREST_POINT , RC_CLOSE_POINTS } |
| Ray casting processes. More... | |
| using | CellCode = unsigned |
| Type of the code of an octree cell. More... | |
| using | cellCodesContainer = std::vector< CellCode > |
| Octree cell codes container. More... | |
| using | cellIndexesContainer = std::vector< unsigned int > |
| Octree cell indexes container. More... | |
| using | NeighboursSet = std::vector< PointDescriptor > |
| A set of neighbours. More... | |
| using | NeighbourCellsSet = std::vector< CellDescriptor > |
| A set of neighbour cells descriptors. More... | |
| using | cellsContainer = std::vector< IndexAndCode > |
| Container of 'IndexAndCode' structures. More... | |
| using | octreeCellFunc = bool(*)(const octreeCell &, void **, NormalizedProgress *) |
Signals | |
| void | updated () |
| Signal sent when the octree organization is modified (cleared, etc.) More... | |
Public Member Functions | |
| ccOctree (ccGenericPointCloud *cloud) | |
| Default constructor. More... | |
| virtual | ~ccOctree () |
| Destructor. More... | |
| void | multiplyBoundingBox (const PointCoordinateType multFactor) |
| Multiplies the bounding-box of the octree. More... | |
| void | translateBoundingBox (const CCVector3 &T) |
| Translates the bounding-box of the octree. More... | |
| ccBBox | getSquareBB () const |
| Returns the octree (square) bounding-box. More... | |
| ccBBox | getPointsBB () const |
| Returns the points bounding-box. More... | |
| virtual void | clear () override |
| Clears the octree. More... | |
| int | getDisplayedLevel () const |
| Returns the currently displayed octree level. More... | |
| void | setDisplayedLevel (int level) |
| Sets the currently displayed octree level. More... | |
| bool | isVisible () const |
| Returns whether octree is visible or not. More... | |
| void | setVisible (bool state) |
| Sets octree visibility. More... | |
| DisplayMode | getDisplayMode () const |
| Returns the currently display mode. More... | |
| void | setDisplayMode (DisplayMode mode) |
| Sets the currently display mode. More... | |
| void | draw (CC_DRAW_CONTEXT &context) |
| Draws the octree. More... | |
| bool | intersectWithFrustum (ccCameraSensor *sensor, std::vector< unsigned > &inCameraFrustum) |
| Intersects octree with a camera sensor. More... | |
| bool | pointPicking (const CCVector2d &clickPos, const ccGLCameraParameters &camera, PointDescriptor &output, double pickWidth_pix=3.0) const |
| Octree-driven point picking algorithm. More... | |
Public Member Functions inherited from cloudViewer::DgmOctree | |
| DgmOctree (GenericIndexedCloudPersist *cloud) | |
| DgmOctree constructor. More... | |
| ~DgmOctree () override=default | |
| DgmOctree destructor. More... | |
| int | build (GenericProgressCallback *progressCb=nullptr) |
| Builds the structure. More... | |
| int | build (const CCVector3 &octreeMin, const CCVector3 &octreeMax, const CCVector3 *pointsMinFilter=nullptr, const CCVector3 *pointsMaxFilter=nullptr, GenericProgressCallback *progressCb=nullptr) |
| Builds the structure with constraints. More... | |
| unsigned | getNumberOfProjectedPoints () const |
| Returns the number of points projected into the octree. More... | |
| const CCVector3 & | getOctreeMins () const |
| Returns the lower boundaries of the octree. More... | |
| const CCVector3 & | getOctreeMaxs () const |
| Returns the higher boundaries of the octree. More... | |
| void | getBoundingBox (CCVector3 &bbMin, CCVector3 &bbMax) const |
| Returns the octree bounding box. More... | |
| const int * | getMinFillIndexes (unsigned char level) const |
| const int * | getMaxFillIndexes (unsigned char level) const |
| const PointCoordinateType & | getCellSize (unsigned char level) const |
| Returns the octree cells length for a given level of subdivision. More... | |
| void | getCellDistanceFromBorders (const Tuple3i &cellPos, unsigned char level, int *cellDists) const |
| void | getCellDistanceFromBorders (const Tuple3i &cellPos, unsigned char level, int neighbourhoodLength, int *cellDists) const |
| bool | getPointsInCellByCellIndex (ReferenceCloud *cloud, unsigned cellIndex, unsigned char level, bool clearOutputCloud=true) const |
| Returns the points lying in a specific cell. More... | |
| bool | getPointsInCell (CellCode cellCode, unsigned char level, ReferenceCloud *subset, bool isCodeTruncated=false, bool clearOutputCloud=true) const |
| Returns the points lying in a specific cell. More... | |
| ReferenceCloud * | getPointsInCellsWithSortedCellCodes (cellCodesContainer &cellCodes, unsigned char level, ReferenceCloud *subset, bool areCodesTruncated=false) const |
| Returns the points lying in multiple cells. More... | |
| unsigned | findPointNeighbourhood (const CCVector3 *_queryPoint, ReferenceCloud *Yk, unsigned maxNumberOfNeighbors, unsigned char level, double &maxSquareDist, double maxSearchDist=0, int *finalNeighbourhoodSize=nullptr) const |
| Finds the nearest neighbours around a query point. More... | |
| double | findTheNearestNeighborStartingFromCell (NearestNeighboursSearchStruct &nNSS) const |
| unsigned | findNearestNeighborsStartingFromCell (NearestNeighboursSearchStruct &nNSS, bool getOnlyPointsWithValidScalar=false) const |
| int | findNeighborsInASphereStartingFromCell (NearestNeighboursSearchStruct &nNSS, double radius, bool sortValues=true) const |
| Advanced form of the nearest neighbours search algorithm (in a sphere) More... | |
| int | getPointsInSphericalNeighbourhood (const CCVector3 &sphereCenter, PointCoordinateType radius, NeighboursSet &neighbours, unsigned char level) const |
| Returns the points falling inside a sphere. More... | |
| std::size_t | getPointsInCylindricalNeighbourhood (CylindricalNeighbourhood ¶ms) const |
| Returns the points falling inside a cylinder. More... | |
| std::size_t | getPointsInCylindricalNeighbourhoodProgressive (ProgressiveCylindricalNeighbourhood ¶ms) const |
| Same as getPointsInCylindricalNeighbourhood with progressive approach. More... | |
| std::size_t | getPointsInBoxNeighbourhood (BoxNeighbourhood ¶ms) const |
| Returns the points falling inside a box. More... | |
| void | getTheCellPosWhichIncludesThePoint (const CCVector3 *thePoint, Tuple3i &cellPos) const |
| void | getTheCellPosWhichIncludesThePoint (const CCVector3 *thePoint, Tuple3i &cellPos, unsigned char level) const |
| void | getTheCellPosWhichIncludesThePoint (const CCVector3 *thePoint, Tuple3i &cellPos, unsigned char level, bool &inBounds) const |
| void | getCellPos (CellCode code, unsigned char level, Tuple3i &cellPos, bool isCodeTruncated) const |
| void | computeCellCenter (CellCode code, unsigned char level, CCVector3 ¢er, bool isCodeTruncated=false) const |
| void | computeCellCenter (const Tuple3i &cellPos, unsigned char level, CCVector3 ¢er) const |
| void | computeCellCenter (const Tuple3s &cellPos, unsigned char level, CCVector3 ¢er) const |
| Short version of computeCellCenter. More... | |
| void | computeCellLimits (CellCode code, unsigned char level, CCVector3 &cellMin, CCVector3 &cellMax, bool isCodeTruncated=false) const |
| Returns the spatial limits of a given cell. More... | |
| unsigned char | findBestLevelForAGivenNeighbourhoodSizeExtraction (PointCoordinateType radius) const |
| unsigned char | findBestLevelForComparisonWithOctree (const DgmOctree *theOtherOctree) const |
| unsigned char | findBestLevelForAGivenPopulationPerCell (unsigned indicativeNumberOfPointsPerCell) const |
| unsigned char | findBestLevelForAGivenCellNumber (unsigned indicativeNumberOfCells) const |
| const CellCode & | getCellCode (unsigned index) const |
| Returns the ith cell code. More... | |
| bool | getCellCodes (unsigned char level, cellCodesContainer &vec, bool truncatedCodes=false) const |
| bool | getCellIndexes (unsigned char level, cellIndexesContainer &vec) const |
| bool | getCellCodesAndIndexes (unsigned char level, cellsContainer &vec, bool truncatedCodes=false) const |
| void | diff (const cellCodesContainer &codesA, const cellCodesContainer &codesB, cellCodesContainer &diffA, cellCodesContainer &diffB) const |
| bool | diff (unsigned char octreeLevel, const cellsContainer &codesA, const cellsContainer &codesB, int &diffA, int &diffB, int &cellsA, int &cellsB) const |
| const unsigned & | getCellNumber (unsigned char level) const |
| Returns the number of cells for a given level of subdivision. More... | |
| double | computeMeanOctreeDensity (unsigned char level) const |
| int | extractCCs (const cellCodesContainer &cellCodes, unsigned char level, bool sixConnexity, GenericProgressCallback *progressCb=nullptr) const |
| int | extractCCs (unsigned char level, bool sixConnexity, GenericProgressCallback *progressCb=nullptr) const |
| unsigned | executeFunctionForAllCellsStartingAtLevel (unsigned char startingLevel, octreeCellFunc func, void **additionalParameters, unsigned minNumberOfPointsPerCell, unsigned maxNumberOfPointsPerCell, bool multiThread=true, GenericProgressCallback *progressCb=nullptr, const char *functionTitle=nullptr, int maxThreadCount=0) |
| unsigned | executeFunctionForAllCellsAtLevel (unsigned char level, octreeCellFunc func, void **additionalParameters, bool multiThread=false, GenericProgressCallback *progressCb=nullptr, const char *functionTitle=nullptr, int maxThreadCount=0) |
| bool | rayCast (const CCVector3 &rayAxis, const CCVector3 &rayOrigin, double maxRadiusOrFov, bool isFOV, RayCastProcess process, std::vector< PointDescriptor > &output) const |
| Ray casting algorithm. More... | |
| GenericIndexedCloudPersist * | associatedCloud () const |
| Returns the associated cloud. More... | |
| const cellsContainer & | pointsAndTheirCellCodes () const |
| Returns the octree 'structure'. More... | |
Public Member Functions inherited from cloudViewer::GenericOctree | |
| virtual | ~GenericOctree ()=default |
| Default destructor. More... | |
Static Public Member Functions | |
| static void | ComputeAverageColor (cloudViewer::ReferenceCloud *subset, ccGenericPointCloud *sourceCloud, ColorCompType meanCol[]) |
| Computes the average color of a set of points. More... | |
| static CCVector3 | ComputeAverageNorm (cloudViewer::ReferenceCloud *subset, ccGenericPointCloud *sourceCloud) |
| Computes the average normal of a set of points. More... | |
| static PointCoordinateType | GuessNaiveRadius (ccGenericPointCloud *cloud) |
| Tries to guess a very naive 'local radius' for octree-based computation. More... | |
| static PointCoordinateType | GuessBestRadius (ccGenericPointCloud *cloud, const BestRadiusParams ¶ms, cloudViewer::DgmOctree *cloudOctree=nullptr, cloudViewer::GenericProgressCallback *progressCb=nullptr) |
| Tries to guess the best 'local radius' for octree-based computation. More... | |
| static PointCoordinateType | GuessBestRadiusAutoComputeOctree (ccGenericPointCloud *cloud, const BestRadiusParams ¶ms, QWidget *parentWidget=nullptr) |
Static Public Member Functions inherited from cloudViewer::DgmOctree | |
| static unsigned char | GET_BIT_SHIFT (unsigned char level) |
| Returns the binary shift for a given level of subdivision. More... | |
| static int | OCTREE_LENGTH (int level) |
| static CellCode | GenerateTruncatedCellCode (const Tuple3i &cellPos, unsigned char level) |
| static CellCode | GenerateTruncatedCellCode (const Tuple3s &pos, unsigned char level) |
| Short version of GenerateTruncatedCellCode. More... | |
| static PointCoordinateType | ComputeMinDistanceToCellBorder (const CCVector3 &queryPoint, PointCoordinateType cs, const CCVector3 &cellCenter) |
| static bool | MultiThreadSupport () |
Static Protected Member Functions | |
| static bool | DrawCellAsABox (const cloudViewer::DgmOctree::octreeCell &cell, void **additionalParameters, cloudViewer::NormalizedProgress *nProgress=0) |
| static bool | DrawCellAsAPoint (const cloudViewer::DgmOctree::octreeCell &cell, void **additionalParameters, cloudViewer::NormalizedProgress *nProgress=0) |
| static bool | DrawCellAsAPrimitive (const cloudViewer::DgmOctree::octreeCell &cell, void **additionalParameters, cloudViewer::NormalizedProgress *nProgress=0) |
Protected Attributes | |
| ccGenericPointCloud * | m_theAssociatedCloudAsGPC |
| Associated cloud (as a ccGenericPointCloud) More... | |
| int | m_displayedLevel |
| Displayed level. More... | |
| DisplayMode | m_displayMode |
| Display mode. More... | |
| ccOctreeFrustumIntersector * | m_frustumIntersector |
| For frustum intersection. More... | |
| bool | m_visible |
| For Octree Display. More... | |
Protected Attributes inherited from cloudViewer::DgmOctree | |
| cellsContainer | m_thePointsAndTheirCellCodes |
| The coded octree structure. More... | |
| GenericIndexedCloudPersist * | m_theAssociatedCloud |
| Associated cloud. More... | |
| unsigned | m_numberOfProjectedPoints |
| Number of points projected in the octree. More... | |
| unsigned | m_nearestPow2 |
| CCVector3 | m_dimMin |
| Min coordinates of the octree bounding-box. More... | |
| CCVector3 | m_dimMax |
| Max coordinates of the octree bounding-box. More... | |
| CCVector3 | m_pointsMin |
| CCVector3 | m_pointsMax |
| PointCoordinateType | m_cellSize [MAX_OCTREE_LEVEL+2] |
| Cell dimensions for all subdivision levels. More... | |
| int | m_fillIndexes [(MAX_OCTREE_LEVEL+1) *6] |
| unsigned | m_cellCount [MAX_OCTREE_LEVEL+1] |
| Number of cells per level of subdivision. More... | |
| unsigned | m_maxCellPopulation [MAX_OCTREE_LEVEL+1] |
| Max cell population per level of subdivision. More... | |
| double | m_averageCellPopulation [MAX_OCTREE_LEVEL+1] |
| Average cell population per level of subdivision. More... | |
| double | m_stdDevCellPopulation [MAX_OCTREE_LEVEL+1] |
| Std. dev. of cell population per level of subdivision. More... | |
Additional Inherited Members | |
Static Public Attributes inherited from cloudViewer::DgmOctree | |
| static const int | MAX_OCTREE_LEVEL = 10 |
| Max octree subdivision level. More... | |
| static const int | MAX_OCTREE_LENGTH = (1 << MAX_OCTREE_LEVEL) |
| Max octree length at last level of subdivision (number of cells) More... | |
| static const CellCode | INVALID_CELL_CODE = (~static_cast<CellCode>(0)) |
| Invalid cell code. More... | |
Protected Member Functions inherited from cloudViewer::DgmOctree | |
| int | genericBuild (GenericProgressCallback *progressCb=nullptr) |
| Generic method to build the octree structure. More... | |
| void | updateMinAndMaxTables () |
| Updates the tables containing octree limits and boundaries. More... | |
| void | updateCellSizeTable () |
| void | updateCellCountTable () |
| void | computeCellsStatistics (unsigned char level) |
| Computes statistics about cells for a given level of subdivision. More... | |
| void | getNeighborCellsAround (const Tuple3i &cellPos, cellIndexesContainer &neighborCellsIndexes, int neighbourhoodLength, unsigned char level) const |
| void | getPointsInNeighbourCellsAround (NearestNeighboursSearchStruct &nNSS, int neighbourhoodLength, bool getOnlyPointsWithValidScalar=false) const |
| Gets point in the neighbourhing cells of a specific cell. More... | |
| unsigned | getCellIndex (CellCode truncatedCellCode, unsigned char bitDec) const |
| Returns the index of a given cell represented by its code. More... | |
| unsigned | getCellIndex (CellCode truncatedCellCode, unsigned char bitDec, unsigned begin, unsigned end) const |
| Returns the index of a given cell represented by its code. More... | |
Octree structure.
Extends the cloudViewer::DgmOctree class.
Definition at line 27 of file ecvOctree.h.
| typedef QSharedPointer<ccOctree> ccOctree::Shared |
Shared pointer.
Definition at line 32 of file ecvOctree.h.
Octree displaying methods.
Definition at line 77 of file ecvOctree.h.
|
explicit |
Default constructor.
| cloud | a point cloud |
|
virtual |
Destructor.
|
overridevirtual |
Clears the octree.
Reimplemented from cloudViewer::DgmOctree.
|
static |
Computes the average color of a set of points.
|
static |
Computes the average normal of a set of points.
Referenced by qFacets::createFacets().
| void ccOctree::draw | ( | CC_DRAW_CONTEXT & | context | ) |
Draws the octree.
|
staticprotected |
|
staticprotected |
|
staticprotected |
|
inline |
Returns the currently displayed octree level.
Definition at line 67 of file ecvOctree.h.
Referenced by ccPropertiesTreeDelegate::fillWithPointOctree().
|
inline |
Returns the currently display mode.
Definition at line 87 of file ecvOctree.h.
| ccBBox ccOctree::getPointsBB | ( | ) | const |
Returns the points bounding-box.
| ccBBox ccOctree::getSquareBB | ( | ) | const |
Returns the octree (square) bounding-box.
|
static |
Tries to guess the best 'local radius' for octree-based computation.
The ideal radius is determined by randomly sampling up to 200 points and looking at their neighborhood.
| cloud | point cloud on which to process the normals. |
| params | parameters |
| cloudOctree | input cloud octree (optional) |
| progressCb | progress notification (optional) |
|
static |
Tries to guess the best 'local radius' for octree-based computation (auto-computes the octree if necessary) The ideal radius is determined by randomly sampling up to 200 points and looking at their neighborhood.
| cloud | point cloud on which to process the normals. |
| params | parameters |
| parentWidget | parent widget (for the progress dialog, if any has to be shown) |
Referenced by FastGlobalRegistrationDialog::autoEstimateRadius().
|
static |
Tries to guess a very naive 'local radius' for octree-based computation.
| cloud | point cloud on which to process the normals. |
Referenced by FastGlobalRegistrationDialog::FastGlobalRegistrationDialog().
| bool ccOctree::intersectWithFrustum | ( | ccCameraSensor * | sensor, |
| std::vector< unsigned > & | inCameraFrustum | ||
| ) |
Intersects octree with a camera sensor.
|
inline |
Returns whether octree is visible or not.
Definition at line 72 of file ecvOctree.h.
| void ccOctree::multiplyBoundingBox | ( | const PointCoordinateType | multFactor | ) |
Multiplies the bounding-box of the octree.
If the cloud coordinates are simply multiplied by the same factor, there is no use in recomputing the octree structure. It's sufficient to update its bounding-box.
| multFactor | multiplication factor |
| bool ccOctree::pointPicking | ( | const CCVector2d & | clickPos, |
| const ccGLCameraParameters & | camera, | ||
| PointDescriptor & | output, | ||
| double | pickWidth_pix = 3.0 |
||
| ) | const |
Octree-driven point picking algorithm.
| void ccOctree::setDisplayedLevel | ( | int | level | ) |
Sets the currently displayed octree level.
| void ccOctree::setDisplayMode | ( | DisplayMode | mode | ) |
Sets the currently display mode.
|
inline |
Sets octree visibility.
Definition at line 74 of file ecvOctree.h.
| void ccOctree::translateBoundingBox | ( | const CCVector3 & | T | ) |
Translates the bounding-box of the octree.
If the cloud has been simply translated, there is no use to recompute the octree structure. It's sufficient to update its bounding-box.
| T | translation vector |
|
signal |
Signal sent when the octree organization is modified (cleared, etc.)
|
protected |
Displayed level.
Definition at line 183 of file ecvOctree.h.
|
protected |
Display mode.
Definition at line 186 of file ecvOctree.h.
|
protected |
For frustum intersection.
Definition at line 189 of file ecvOctree.h.
|
protected |
Associated cloud (as a ccGenericPointCloud)
Definition at line 180 of file ecvOctree.h.
|
protected |
For Octree Display.
Definition at line 192 of file ecvOctree.h.