Octree. More...
#include <Boctree.h>
Public Member Functions | |
void | AllPoints (vector< T *> &vp) |
BOctTree () | |
template<class P > | |
BOctTree (P *const *pts, int n, T voxelSize, PointType _pointtype=PointType(), bool _earlystop=false) | |
BOctTree (std::string filename) | |
template<class P > | |
BOctTree (vector< P *> &pts, T voxelSize, PointType _pointtype=PointType(), bool _earlystop=false) | |
BOctTree (const BOctTree &other, unsigned char *mem_ptr, unsigned int mem_max) | |
long | countLeaves () |
long | countNodes () |
long | countOctLeaves () |
void | deserialize (std::string filename) |
const T * | getCenter () const |
void | getCenter (double _center[3]) const |
unsigned int | getMaxDepth () const |
const T * | getMaxs () const |
unsigned int | getMemorySize () |
Size of the whole tree structure, including the main class, its serialize critical allocated variables and nodes, not the allocator. More... | |
const T * | getMins () const |
void | GetOctTreeCenter (vector< T *> &c) |
void | GetOctTreeRandom (vector< T *> &c) |
void | GetOctTreeRandom (vector< T *> &c, unsigned int ptspervoxel) |
unsigned int | getPointdim () const |
const bitoct & | getRoot () const |
T | getSize () const |
void | init () |
T * | pickPoint (bitoct &node) |
void | serialize (std::string filename) |
virtual | ~BOctTree () |
Public Member Functions inherited from SearchTree | |
virtual void | getPtPairs (vector< PtPair > *pairs, double *source_alignxf, double *const *q_points, unsigned int startindex, unsigned int endindex, int thread_num, int rnd, double max_dist_match2, double &sum, double *centroid_m, double *centroid_d) |
virtual void | getPtPairs (vector< PtPair > *pairs, double *source_alignxf, const DataXYZ &xyz_r, unsigned int startindex, unsigned int endindex, int thread_num, int rnd, double max_dist_match2, double &sum, double *centroid_m, double *centroid_d) |
virtual void | lock () |
SearchTree () | |
SearchTree (double **pts, int n) | |
virtual void | unlock () |
virtual | ~SearchTree () |
Public Member Functions inherited from Tree | |
virtual | ~Tree () |
Static Public Member Functions | |
static void | childcenter (const T *pcenter, T *ccenter, T size, unsigned char i) |
static void | childcenter (int x, int y, int z, int &cx, int &cy, int &cz, char i, int size) |
static void | deserialize (std::string filename, vector< Point > &points) |
static PointType | readType (std::string filename) |
Protected Member Functions | |
void | _FindClosest (int threadNum, bitoct &node, int size, int x, int y, int z) const |
void | AllPoints (bitoct &node, vector< T *> &vp) |
template<class P > | |
void * | branch (bitoct &node, P *const *splitPoints, int n, T _center[3], T _size) |
template<class P > | |
void * | branch (bitoct &node, vector< P *> &splitPoints, T _center[3], T _size) |
template<class P > | |
unsigned char | childIndex (const T *center, const P *point) |
long | countLeaves (bitoct &node) |
long | countNodes (bitoct &node) |
long | countOctLeaves (bitoct &node) |
template<class P > | |
void | countPointsAndQueue (vector< P *> &i_points, T center[8][3], T size, bitoct &parent, T *pcenter) |
template<class P > | |
void | countPointsAndQueueFast (P *const *points, int n, T center[8][3], T size, bitoct &parent, T pcenter[3]) |
void | deletetNodes (bitoct &node) |
void | deserialize (std::ifstream &f, bitoct &node) |
double * | FindClosest (double *point, double maxdist2, int threadNum) const |
double * | FindClosestInBucket (double *point, double maxdist2, int threadNum) |
void | findClosestInLeaf (bitunion< T > *node, int threadNum) const |
template<class P > | |
void | fullsort (P *const *points, int n, T splitval[3], P *const *blocks[9]) |
void | getByIndex (T *point, T *&points, unsigned int &length) |
void | GetOctTreeCenter (vector< T *> &c, bitoct &node, T *center, T size) |
void | GetOctTreeRandom (vector< T *> &c, bitoct &node) |
void | GetOctTreeRandom (vector< T *> &c, unsigned int ptspervoxel, bitoct &node) |
void | serialize (std::ofstream &of, bitoct &node) |
template<class P > | |
P *const * | sort (P *const *points, unsigned int n, T splitval, unsigned char index) |
Static Protected Member Functions | |
static void | deserialize (std::ifstream &f, vector< Point > &vpoints, PointType &pointtype) |
Protected Attributes | |
T | add [3] |
Offset and real voxelsize inverse factor for manipulation points. More... | |
Allocator * | alloc |
Allocator used for creating nodes in the constructor. More... | |
T | center [3] |
storing the center More... | |
ip::offset_ptr< unsigned int > | child_bit_depth |
ip::offset_ptr< unsigned int > | child_bit_depth_inv |
bool | earlystop |
Whether to stop subdividing at N<10 nodes or not. More... | |
int | largest_index |
unsigned char | max_depth |
? More... | |
ip::offset_ptr< T > | maxs |
ip::offset_ptr< T > | mins |
storing minimal and maximal values for all dimensions More... | |
T | mult |
unsigned int | POINTDIM |
Dimension of each point: 3 (xyz) + N (attributes) More... | |
PointType | pointtype |
Details of point attributes. More... | |
T | real_voxelSize |
The real voxelsize of the leaves. More... | |
ip::offset_ptr< bitoct > | root |
the root of the octree More... | |
T | size |
storing the dimension More... | |
ip::offset_ptr< bitunion< T > > | uroot |
T | voxelSize |
storing the voxel size More... | |
Static Protected Attributes | |
static NNParams | params [100] |
Threadlocal storage of parameters used in SearchTree operations. More... | |
Private Member Functions | |
void | copy_children (const bitoct &other, bitoct &my) |
unsigned int | sizeChildren (const bitoct &node) |
Recursive size of a node's children. More... | |
Octree.
A cubic bounding box is calculated from the given 3D points. Then it is recusivly subdivided into smaller subboxes
|
inlineprotected |
This is the heavy duty search function doing most of the (theoretically unneccesary) work. The tree is recursively searched. Depending on which of the 8 child-voxels is closer to the query point, the children are examined in a special order. This order is defined in map, imap is its inverse and sequence2ci is a speedup structure for faster access to the child indices.
|
inline |
|
inlinestatic |
|
inlinestatic |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotectedvirtual |
This function finds the closest point in the octree given a specified radius. This implementation is quit complex, although it is already simplified. The simplification incurs a significant loss in speed, as several calculations have to be performed repeatedly and a high number of unnecessary jumps are executed.
Implements SearchTree.
|
inlineprotected |
This function shows the possible speedup that can be gained by using the octree for nearest neighbour search, if a more sophisticated implementation were given. Here, only the bucket in which the query point falls is looked up. If doing the same thing in the kd-tree search, this function is about 3-5 times as fast
|
inlineprotected |
|
inlineprotected |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inline |
|
inlineprotected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Threadlocal storage of parameters used in SearchTree operations.
Serialization uncritical, runtime relevant variables
|
protected |
|
protected |
|
protected |
|
protected |