OGS
|
POINT | point data type the OctTree will use |
MAX_POINTS | maximum number of pointers of POINT in a leaf |
#include <OctTree.h>
Public Member Functions | |
virtual | ~OctTree () |
bool | addPoint (POINT *pnt, POINT *&ret_pnt) |
template<typename T > | |
void | getPointsInRange (T const &min, T const &max, std::vector< POINT * > &pnts) const |
Eigen::Vector3d const & | getLowerLeftCornerPoint () const |
Eigen::Vector3d const & | getUpperRightCornerPoint () const |
OctTree< POINT, MAX_POINTS > const * | getChild (std::size_t i) const |
std::vector< POINT * > const & | getPointVector () const |
Static Public Member Functions | |
static OctTree< POINT, MAX_POINTS > * | createOctTree (Eigen::Vector3d ll, Eigen::Vector3d ur, double eps=std::numeric_limits< double >::epsilon()) |
Private Types | |
enum class | Quadrant : std::int8_t { NEL = 0 , NWL , SWL , SEL , NEU , NWU , SWU , SEU } |
Private Member Functions | |
OctTree (Eigen::Vector3d const &ll, Eigen::Vector3d const &ur, double eps) | |
bool | addPoint_ (POINT *pnt, POINT *&ret_pnt) |
bool | addPointToChild (POINT *pnt) |
void | splitNode (POINT *pnt) |
bool | isOutside (POINT *pnt) const |
Private Attributes | |
std::array< OctTree< POINT, MAX_POINTS > *, 8 > | _children |
Eigen::Vector3d const | _ll |
lower left front face point of the cube | |
Eigen::Vector3d const | _ur |
upper right back face point of the cube | |
std::vector< POINT * > | _pnts |
vector of pointers to POINT objects | |
bool | _is_leaf |
flag if this OctTree is a leaf | |
double const | _eps |
threshold for point uniqueness | |
|
strongprivate |
Enumerator | |
---|---|
NEL | north east lower |
NWL | north west lower |
SWL | south west lower |
SEL | south east lower |
NEU | south west upper |
NWU | south west upper |
SWU | south west upper |
SEU | south east upper |
|
virtual |
Destroys the children of this node.
Definition at line 68 of file OctTree-impl.h.
|
private |
private constructor
ll | lower left point |
ur | upper right point |
eps | the euclidean distance as a threshold to make objects unique |
Definition at line 181 of file OctTree-impl.h.
References GeoLib::OctTree< POINT, MAX_POINTS >::_children.
bool GeoLib::OctTree< POINT, MAX_POINTS >::addPoint | ( | POINT * | pnt, |
POINT *& | ret_pnt ) |
This method adds the given point to the OctTree. If necessary, new OctTree nodes will be inserted deploying a split of the corresponding OctTree node.
pnt | the pointer to a point that should be inserted |
ret_pnt | the pointer to a point in the OctTree. Three cases can occur: (1) ret_pnt is nullptr: the given point (pnt) is outside of the OctTree domain (2) ret_pnt is equal to pnt: the point is added to the OctTree (3) In case ret_pnt is neither equal to pnt nor equal to nullptr, another item within the eps distance is already in the OctTree and the pointer to this object is returned. |
Definition at line 77 of file OctTree-impl.h.
Referenced by makeNodesUnique(), and resetNodesInRegularElements().
|
private |
This method tries to add the given point to the OctTree. If necessary for adding the point, new nodes will be inserted into the OctTree.
pnt,ret_pnt | see documentation of addPoint() |
Definition at line 189 of file OctTree-impl.h.
|
private |
This method adds the given point to the OctTree. If necessary, the OctTree will be extended.
pnt | the point |
Definition at line 227 of file OctTree-impl.h.
|
static |
Create an OctTree object. The arguments ll and ur are used to compute a cube domain the OctTree will living in.
ll | lower left front point, used for computation of cubic domain |
ur | upper right back point, used for computation of cubic domain |
eps | the euclidean distance as a threshold to make objects unique [default std::numeric_limits<double>::epsilon()] Adding a new item to an already "filled" OctTree node results in a split of the OctTree node. The smaller this number is the more leaves the OctTree will have, i.e. it needs more memory and more time to walk through the OctTree, but the search inside a leaf is fast. In contrast a big value results into a smaller number of OctTree leaves, the memory requirements for the OctTree may be lower but the search inside a OctTree leaf may be more expensive. The value should be chosen application dependent. [default 8] |
Definition at line 16 of file OctTree-impl.h.
Referenced by main().
|
inline |
Definition at line 79 of file OctTree.h.
References GeoLib::OctTree< POINT, MAX_POINTS >::_children.
|
inline |
void GeoLib::OctTree< POINT, MAX_POINTS >::getPointsInRange | ( | T const & | min, |
T const & | max, | ||
std::vector< POINT * > & | pnts ) const |
range query - returns all points inside the range [min[0], max[0]) x [min[1], max[1]) x [min[2], max[2])
Definition at line 148 of file OctTree-impl.h.
Referenced by getExistingNodeFromOctTree().
|
inline |
|
inline |
|
private |
checks if the given point pnt is outside of the OctTree node.
pnt | the point that check is performed on |
Definition at line 329 of file OctTree-impl.h.
|
private |
Creates the child nodes of this leaf and distribute the points stored in _pnts to the children.
pnt | the pointer to the points that is responsible for the split |
Definition at line 247 of file OctTree-impl.h.
|
private |
children are sorted: _children[0] is north east lower child _children[1] is north west lower child _children[2] is south west lower child _children[3] is south east lower child _children[4] is north east upper child _children[5] is north west upper child _children[6] is south west upper child _children[7] is south east upper child
Definition at line 139 of file OctTree.h.
Referenced by GeoLib::OctTree< POINT, MAX_POINTS >::OctTree(), and GeoLib::OctTree< POINT, MAX_POINTS >::getChild().
|
private |
|
private |
|
private |
lower left front face point of the cube
Definition at line 141 of file OctTree.h.
Referenced by GeoLib::OctTree< POINT, MAX_POINTS >::getLowerLeftCornerPoint().
|
private |
vector of pointers to POINT objects
Definition at line 145 of file OctTree.h.
Referenced by GeoLib::OctTree< POINT, MAX_POINTS >::getPointVector().
|
private |
upper right back face point of the cube
Definition at line 143 of file OctTree.h.
Referenced by GeoLib::OctTree< POINT, MAX_POINTS >::getUpperRightCornerPoint().