#include <Octree.hpp>
Public Types | |
typedef Location::LocCode | LocCode |
typedef float | Scalar |
Public Member Functions | |
C_Octree () | |
~C_Octree () | |
cell | |
bool | is_leaf (CellHandle _ch) const |
bool | is_extraction_leaf (CellHandle _ch) const |
bool | is_root (CellHandle _ch) const |
int | level (CellHandle _ch) const |
int | depth (CellHandle _ch) const |
bool | is_inner_boundary (CellHandle _ch) const |
int | getChildIndex (BaseVecT center, coord< float > *point) |
int | getChildIndex (BaseVecT center, BaseVecT point) |
void | split (CellHandle _ch, const bool bGarbageCollectionOnTheFly=false) |
Split the cell, i.e. create eight children. More... | |
void | SetPickedCell (CellHandle _ch) |
Set the cell handle of the picked cell. More... | |
void | ResetPickedCell () |
Reset the cell handle of the picked cell. More... | |
bool | PickParentCell () |
Pick the parent cell of the currently picked cell. More... | |
bool | PickChildCell (int _idx) |
Pick the child cell of the currently picked cell. More... | |
void | ResetNumberOfGeneratedCells () |
Reset the number of generated cells. More... | |
LocCode | SetExtractionLevel (LocCode _level) |
Set the level to be treated as leaf level. More... | |
iterators | |
CellHandle | root () const |
CellHandle | end () const |
navigation | |
CellHandle | parent (CellHandle _ch) const |
CellHandle | child (CellHandle _ch, int _idx) const |
CellHandle | face_neighbor (CellHandle _ch, int _idx) const |
CellHandle | edge_neighbor (CellHandle _ch, int _idx) const |
std::pair< std::vector< CellHandle >, std::vector< uint > > | all_corner_neighbors (CellHandle _ch, int _idx) const |
CellHandle | corner_neighbor (CellHandle _ch, int _idx) const |
void | MovePickedCell (int _key, double *_mvm) |
Moving the picked cell, i.e. picking one of the neighbouring cells (if possible) More... | |
void | MovePickedCellLeft (double *_mvm) |
void | MovePickedCellRight (double *_mvm) |
void | MovePickedCellUp (double *_mvm) |
void | MovePickedCellDown (double *_mvm) |
query | |
int | size () const |
int | nr_cells () const |
BaseVecT | cell_corner (CellHandle _ch, int _idx) const |
void | cell_corner (CellHandle _ch, Scalar &_x, Scalar &_y, Scalar &_z, Scalar &_size) const |
void | cell_corner (CellHandle _ch, int _idx, Scalar &_x, Scalar &_y, Scalar &_z) const |
void | cell_corner (CellHandle _ch, int _idx, Scalar &_x, Scalar &_y, Scalar &_z, Scalar &_size) const |
BaseVecT | cell_center (CellHandle _ch) const |
void | cell_center (CellHandle _ch, Scalar &_x, Scalar &_y, Scalar &_z) const |
void | cell_center (CellHandle _ch, Scalar &_x, Scalar &_y, Scalar &_z, Scalar &_size) const |
Scalar | cell_size (CellHandle _ch) const |
Location & | location (CellHandle _h) |
const Location & | location (CellHandle _h) const |
CellHandle | cell (Scalar _x, Scalar _y, Scalar _z) const |
CellHandle | GetPickedCell () const |
Get the handle of the picked cell. More... | |
int | GetNumberOfGeneratedCells () const |
Get number of generated cells. More... | |
LocCode | GetExtractionLevel () const |
Get the level to be treated as leaf level. More... | |
memory | |
void | reserve (unsigned int _size) |
void | resize (unsigned int _size) |
void | initialize (int _max_octree_level) |
Initializing the octree with maximal level = root level (leafs have level 0) More... | |
void | clear () |
Public Attributes | |
std::vector< T_CellData > | m_OctreeCell |
Vector containing the cells. More... | |
Static Public Attributes | |
static const int | MAX_ROOT_LEVEL = sizeof(LocCode)*8-1 |
Maximal root level defined by size of data type of the cell coordinates (leafs have side length 1) More... | |
Protected Member Functions | |
int | cell (int _i) const |
CellHandle | get_common_ancestor (CellHandle _ch, LocCode _diff) const |
CellHandle | get_common_ancestor (CellHandle _ch, LocCode _diff0, LocCode _diff1) const |
CellHandle | get_common_ancestor (CellHandle _ch, LocCode _diff0, LocCode _diff1, LocCode _diff2) const |
void | set_cell (int _i, int _cell) |
CellHandle | traverse (CellHandle _ch, LocCode _loc_x, LocCode _loc_y, LocCode _loc_z) const |
CellHandle | traverse_to_level (CellHandle _ch, LocCode _loc_x, LocCode _loc_y, LocCode _loc_z, LocCode _level) const |
Protected Attributes | |
LocCode | m_ExtractionLevel |
Level of the cells to be treated as leafs during surface extraction. More... | |
size_t | m_nextFreeBlock |
Pointer to the next free block (garbage collection) More... | |
int | m_NumberOfGeneratedCells |
Number of octree cells generated; this counter is adjusted in the split routine only. More... | |
CellHandle | m_PickedCell |
The handle of the picked octree cell. More... | |
LocCode | m_rootLevel |
Root level. More... | |
An octree implementation using techniques described in
"Simple and efficient traversal methods for quadtrees and octrees", Sarah F. Frisken, Ronald N. Perry Journal of Graphics Tools, 7(3):1–11, 2002
Definition at line 26 of file Octree.hpp.
typedef Location::LocCode lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::LocCode |
Definition at line 30 of file Octree.hpp.
typedef float lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::Scalar |
Definition at line 31 of file Octree.hpp.
|
inline |
Definition at line 36 of file Octree.hpp.
|
inline |
Definition at line 37 of file Octree.hpp.
|
inline |
Definition at line 730 of file Octree.hpp.
|
inline |
Definition at line 963 of file Octree.hpp.
|
inlineprotected |
Definition at line 223 of file Octree.hpp.
|
inline |
Definition at line 138 of file Octree.hpp.
|
inline |
Definition at line 345 of file Octree.hpp.
|
inline |
Definition at line 360 of file Octree.hpp.
|
inline |
Definition at line 122 of file Octree.hpp.
|
inline |
Definition at line 330 of file Octree.hpp.
|
inline |
Definition at line 402 of file Octree.hpp.
|
inline |
Definition at line 375 of file Octree.hpp.
|
inline |
Definition at line 152 of file Octree.hpp.
|
inline |
Definition at line 282 of file Octree.hpp.
|
inline |
Definition at line 198 of file Octree.hpp.
|
inline |
Definition at line 799 of file Octree.hpp.
|
inline |
Definition at line 915 of file Octree.hpp.
|
inline |
Definition at line 605 of file Octree.hpp.
|
inline |
Definition at line 98 of file Octree.hpp.
|
inline |
Definition at line 484 of file Octree.hpp.
|
inlineprotected |
Definition at line 545 of file Octree.hpp.
|
inlineprotected |
Definition at line 561 of file Octree.hpp.
|
inlineprotected |
Definition at line 593 of file Octree.hpp.
int lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::getChildIndex | ( | BaseVecT | center, |
coord< float > * | point | ||
) |
center | The center of a cell in real world coordinates |
point | Point for to check it's position relative to the cell center |
INDICES: 000 left down behind 001 right down behind 010 left top behind 011 right top behind 100 left down front 101 right down front 110 left top front 111 right top front
Definition at line 1198 of file Octree.hpp.
int lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::getChildIndex | ( | BaseVecT | center, |
BaseVecT | point | ||
) |
Definition at line 1204 of file Octree.hpp.
|
inline |
Get the level to be treated as leaf level.
Definition at line 175 of file Octree.hpp.
|
inline |
Get number of generated cells.
Definition at line 172 of file Octree.hpp.
|
inline |
Get the handle of the picked cell.
Definition at line 169 of file Octree.hpp.
|
inline |
Initializing the octree with maximal level = root level (leafs have level 0)
Definition at line 184 of file Octree.hpp.
|
inline |
Definition at line 314 of file Octree.hpp.
|
inline |
Definition at line 940 of file Octree.hpp.
|
inline |
Definition at line 306 of file Octree.hpp.
|
inline |
Definition at line 322 of file Octree.hpp.
|
inline |
Definition at line 907 of file Octree.hpp.
|
inline |
Definition at line 158 of file Octree.hpp.
|
inline |
Definition at line 162 of file Octree.hpp.
void lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::MovePickedCell | ( | int | _direction, |
double * | _mvm | ||
) |
Moving the picked cell, i.e. picking one of the neighbouring cells (if possible)
_direction | Direction of the movement |
_mvm | The current modelview matrix needed for estimating the plane of movement |
The rows of the current modelview matrix correspond to the camera axes in the world space. We use here the maximal components of the x- and y-axis as "guides" in which direction to move in the octree. This approach works only because the octree cells are world-axis-aligned!
Definition at line 1034 of file Octree.hpp.
void lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::MovePickedCellDown | ( | double * | _mvm | ) |
Definition at line 1018 of file Octree.hpp.
void lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::MovePickedCellLeft | ( | double * | _mvm | ) |
Definition at line 994 of file Octree.hpp.
void lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::MovePickedCellRight | ( | double * | _mvm | ) |
Definition at line 1002 of file Octree.hpp.
void lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::MovePickedCellUp | ( | double * | _mvm | ) |
Definition at line 1010 of file Octree.hpp.
|
inline |
Definition at line 931 of file Octree.hpp.
|
inline |
Definition at line 290 of file Octree.hpp.
|
inline |
Pick the child cell of the currently picked cell.
Definition at line 78 of file Octree.hpp.
|
inline |
Pick the parent cell of the currently picked cell.
Definition at line 67 of file Octree.hpp.
|
inline |
Definition at line 266 of file Octree.hpp.
|
inline |
Reset the number of generated cells.
Definition at line 89 of file Octree.hpp.
|
inline |
Reset the cell handle of the picked cell.
Definition at line 61 of file Octree.hpp.
|
inline |
Definition at line 274 of file Octree.hpp.
|
inline |
Definition at line 298 of file Octree.hpp.
|
inlineprotected |
Definition at line 228 of file Octree.hpp.
|
inline |
Set the level to be treated as leaf level.
Definition at line 92 of file Octree.hpp.
|
inline |
Set the cell handle of the picked cell.
Definition at line 55 of file Octree.hpp.
|
inline |
Definition at line 923 of file Octree.hpp.
void lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::split | ( | CellHandle | _parent, |
const bool | bGarbageCollectionOnTheFly = false |
||
) |
Split the cell, i.e. create eight children.
_parent | The cell handle of the parent cell |
bGarbageCollectionOnTheFly | true, if garbage collection should be done |
The following method simply splits an octree cell and generates 8 children cells. Depending on the value of bGarbageCollectionOnTheFly EITHER (false; default value) the new cells are simply pushed back in the vector(s) OR (true) we fill the next free block with the new cells, i.e. that the pointer to the next free block "m_nextFreeBlock" must not pointer to the end of the vector(s).
Definition at line 1222 of file Octree.hpp.
|
inlineprotected |
Definition at line 429 of file Octree.hpp.
|
inlineprotected |
Definition at line 454 of file Octree.hpp.
|
protected |
Level of the cells to be treated as leafs during surface extraction.
Definition at line 258 of file Octree.hpp.
|
protected |
Pointer to the next free block (garbage collection)
Definition at line 249 of file Octree.hpp.
|
protected |
Number of octree cells generated; this counter is adjusted in the split routine only.
Definition at line 255 of file Octree.hpp.
std::vector<T_CellData> lvr2::C_Octree< BaseVecT, BoxT, T_CellData >::m_OctreeCell |
Vector containing the cells.
Definition at line 262 of file Octree.hpp.
|
protected |
The handle of the picked octree cell.
Definition at line 252 of file Octree.hpp.
|
protected |
Root level.
Definition at line 246 of file Octree.hpp.
|
static |
Maximal root level defined by size of data type of the cell coordinates (leafs have side length 1)
Definition at line 34 of file Octree.hpp.