MVE - Multi-View Environment mve-devel
Loading...
Searching...
No Matches
Classes | Public Member Functions | List of all members
fssr::Octree Class Reference

A regular octree data structure (each node has zero or eight child nodes). More...

#include <octree.h>

Classes

struct  Iterator
 Octree iterator that keeps track of level and path through the octree. More...
 
struct  Node
 Simple recursive octree node that stores samples in a vector. More...
 

Public Member Functions

 Octree (void)
 
virtual ~Octree (void)
 
void clear (void)
 Resets the octree to its initial state.
 
void clear_samples (void)
 Clears all samples in all nodes.
 
Iterator get_iterator_for_root (void) const
 Returns an octree iterator for the root.
 
int get_max_level (void) const
 Returns the maximum level on which voxels are generated.
 
int get_num_levels (void) const
 Returns the number of levels (WARNING: traverses whole tree).
 
std::size_t get_num_nodes (void) const
 Returns the number of nodes in the octree.
 
std::size_t get_num_samples (void) const
 Returns the number of samples in the octree.
 
Node const * get_root_node (void) const
 Returns the root node (read-only).
 
math::Vec3d const & get_root_node_center (void) const
 Returns the center of the root node.
 
double get_root_node_size (void) const
 Returns the size of the root node.
 
void get_samples_per_level (std::vector< std::size_t > *stats) const
 Returns octree level statistics (WARNING: traverses whole tree).
 
void influence_query (math::Vec3d const &pos, double factor, std::vector< Sample const * > *result) const
 Queries all samples that influence the given point.
 
void insert_sample (Sample const &s)
 Inserts a single sample into the octree.
 
void insert_samples (SampleList const &samples)
 Inserts all samples from the point set into the octree.
 
void limit_octree_level (void)
 Limits the octree to the max level.
 
void node_center_and_size (Iterator const &iter, math::Vec3d *center, double *size) const
 Retuns center and size for the iterator node.
 
void print_stats (std::ostream &out)
 Prints some octree statistics to the stream.
 
void refine_octree (void)
 Refines the octree by subdividing all leaves.
 
void set_max_level (int max_level)
 Sets the maximum level on which voxels are generated.
 

Detailed Description

A regular octree data structure (each node has zero or eight child nodes).

The octree is limited to 20 levels because of the way the iterator works and the voxel indexing scheme (see voxel.h).

Definition at line 29 of file octree.h.

Constructor & Destructor Documentation

◆ Octree()

fssr::Octree::Octree ( void  )
inline

Definition at line 233 of file octree.h.

◆ ~Octree()

fssr::Octree::~Octree ( void  )
inlinevirtual

Definition at line 240 of file octree.h.

Member Function Documentation

◆ clear()

void fssr::Octree::clear ( void  )
inline

Resets the octree to its initial state.

Definition at line 246 of file octree.h.

◆ clear_samples()

void fssr::Octree::clear_samples ( void  )
inline

Clears all samples in all nodes.

Definition at line 258 of file octree.h.

◆ get_iterator_for_root()

Octree::Iterator fssr::Octree::get_iterator_for_root ( void  ) const

Returns an octree iterator for the root.

Definition at line 335 of file octree.cc.

◆ get_max_level()

int fssr::Octree::get_max_level ( void  ) const
inline

Returns the maximum level on which voxels are generated.

The root level is 0, children are at level 1, and so on.

Definition at line 325 of file octree.h.

◆ get_num_levels()

int fssr::Octree::get_num_levels ( void  ) const
inline

Returns the number of levels (WARNING: traverses whole tree).

For an empty octree (without any nodes), this returns 0. For one root node only, this returns 1, and so on.

Definition at line 279 of file octree.h.

◆ get_num_nodes()

std::size_t fssr::Octree::get_num_nodes ( void  ) const
inline

Returns the number of nodes in the octree.

Definition at line 273 of file octree.h.

◆ get_num_samples()

std::size_t fssr::Octree::get_num_samples ( void  ) const
inline

Returns the number of samples in the octree.

Definition at line 267 of file octree.h.

◆ get_root_node()

Octree::Node const * fssr::Octree::get_root_node ( void  ) const
inline

Returns the root node (read-only).

Definition at line 292 of file octree.h.

◆ get_root_node_center()

math::Vec3d const & fssr::Octree::get_root_node_center ( void  ) const
inline

Returns the center of the root node.

Definition at line 298 of file octree.h.

◆ get_root_node_size()

double fssr::Octree::get_root_node_size ( void  ) const
inline

Returns the size of the root node.

Definition at line 304 of file octree.h.

◆ get_samples_per_level()

void fssr::Octree::get_samples_per_level ( std::vector< std::size_t > *  stats) const
inline

Returns octree level statistics (WARNING: traverses whole tree).

For an empty octree (without any nodes), the result vector is empty. Otherwise the vector contains the samples per level, root being zero.

Definition at line 285 of file octree.h.

◆ influence_query()

void fssr::Octree::influence_query ( math::Vec3d const &  pos,
double  factor,
std::vector< Sample const * > *  result 
) const
inline

Queries all samples that influence the given point.

The actual influence distance is given as factor of the sample's scale value, which depends on the basis functions used.

Definition at line 310 of file octree.h.

◆ insert_sample()

void fssr::Octree::insert_sample ( Sample const &  s)

Inserts a single sample into the octree.

The sample scale is used to determine the approriate octree level. If the sample is outside the octree root, the octree is expanded. Although new samples are not inserted in levels finer than the maximum level, samples can still end up in finer levels due to octree expansion. Thus limit_octree_level() method must be called once after all samples have been inserted.

Definition at line 160 of file octree.cc.

◆ insert_samples()

void fssr::Octree::insert_samples ( SampleList const &  samples)

Inserts all samples from the point set into the octree.

Definition at line 153 of file octree.cc.

◆ limit_octree_level()

void fssr::Octree::limit_octree_level ( void  )

Limits the octree to the max level.

This must be called before computing the implicit function or isosurface extraction.

Definition at line 424 of file octree.cc.

◆ node_center_and_size()

void fssr::Octree::node_center_and_size ( Iterator const &  iter,
math::Vec3d center,
double *  size 
) const

Retuns center and size for the iterator node.

Definition at line 319 of file octree.cc.

◆ print_stats()

void fssr::Octree::print_stats ( std::ostream &  out)

Prints some octree statistics to the stream.

Definition at line 462 of file octree.cc.

◆ refine_octree()

void fssr::Octree::refine_octree ( void  )

Refines the octree by subdividing all leaves.

Definition at line 403 of file octree.cc.

◆ set_max_level()

void fssr::Octree::set_max_level ( int  max_level)
inline

Sets the maximum level on which voxels are generated.

The default is 20, which is the maximum allowed level (see voxel.h).

Definition at line 319 of file octree.h.


The documentation for this class was generated from the following files: