ACloudViewer  3.9.4
A Modern Library for 3D Data Processing
ecvKdTree.h
Go to the documentation of this file.
1 // ----------------------------------------------------------------------------
2 // - CloudViewer: www.cloudViewer.org -
3 // ----------------------------------------------------------------------------
4 // Copyright (c) 2018-2024 www.cloudViewer.org
5 // SPDX-License-Identifier: MIT
6 // ----------------------------------------------------------------------------
7 
8 #pragma once
9 
10 // cloudViewer
11 #include <TrueKdTree.h>
12 
13 // Local
14 #include "ecvHObject.h"
15 
16 // System
17 #include <unordered_set>
18 
20 
22 
25  public ccHObject {
26 public:
28 
30  explicit ccKdTree(ccGenericPointCloud* aCloud);
31 
33 
38  void multiplyBoundingBox(const PointCoordinateType multFactor);
39 
41 
46 
48  virtual CV_CLASS_ENUM getClassID() const override {
50  }
51 
52  // Inherited from ccHObject
53  virtual ccBBox getOwnBB(bool withGLFeatures = false) override;
54 
59 
61  ccBBox getCellBBox(BaseNode* node) const;
62 
64  typedef std::unordered_set<Leaf*> LeafSet;
65 
68  ccKdTree::LeafSet& neighbors,
69  const int* userDataFilter = 0);
70 
73  return m_associatedGenericCloud;
74  }
75 
76 protected:
77  // Inherited from ccHObject
78  virtual void drawMeOnly(CC_DRAW_CONTEXT& context) override;
79 
82 };
float PointCoordinateType
Type of the coordinates of a (N-D) point.
Definition: CVTypes.h:16
int64_t CV_CLASS_ENUM
Type of object type flags (64 bits)
Definition: CVTypes.h:97
#define CV_DB_LIB_API
Definition: CV_db.h:15
Bounding box structure.
Definition: ecvBBox.h:25
A 3D cloud interface with associated features (color, normals, octree, etc.)
Hierarchical CLOUDVIEWER Object.
Definition: ecvHObject.h:25
KD-tree structure.
Definition: ecvKdTree.h:25
bool getNeighborLeaves(BaseNode *cell, ccKdTree::LeafSet &neighbors, const int *userDataFilter=0)
Returns the neighbor leaves around a given cell.
void translateBoundingBox(const CCVector3 &T)
Translates the bounding-box of the tree.
std::unordered_set< Leaf * > LeafSet
A set of leaves.
Definition: ecvKdTree.h:64
ccKdTree(ccGenericPointCloud *aCloud)
Default constructor.
ccGenericPointCloud * m_associatedGenericCloud
Associated cloud.
Definition: ecvKdTree.h:81
bool convertCellIndexToRandomColor()
Flag points with a random color per leaf.
ccBBox getCellBBox(BaseNode *node) const
Returns the bounding-box of a given cell.
virtual ccBBox getOwnBB(bool withGLFeatures=false) override
Returns the entity's own bounding-box.
ccGenericPointCloud * associatedGenericCloud() const
Returns associated (generic) point cloud.
Definition: ecvKdTree.h:72
virtual void drawMeOnly(CC_DRAW_CONTEXT &context) override
Draws the entity only (not its children)
virtual CV_CLASS_ENUM getClassID() const override
Returns class ID.
Definition: ecvKdTree.h:48
void multiplyBoundingBox(const PointCoordinateType multFactor)
Multiplies the bounding-box of the tree.
bool convertCellIndexToSF()
Flag points with cell index (as a scalar field)
Proper KD-tree implementation.
Definition: TrueKdTree.h:23
ImGuiContext * context
Definition: Window.cpp:76
@ POINT_KDTREE
Definition: CVTypes.h:111
Display context.