10#ifndef FSSR_OCTREE_HEADER
11#define FSSR_OCTREE_HEADER
61 Node* first_node (
void);
62 Node* first_leaf (
void);
63 Node* next_node (
void);
64 Node* next_branch (
void);
65 Node* next_leaf (
void);
67 Iterator descend (uint8_t level, uint64_t path)
const;
85 void clear_samples (
void);
90 void insert_samples (
SampleList const& samples);
100 void insert_sample (
Sample const& s);
103 std::size_t get_num_samples (
void)
const;
108 std::size_t get_num_nodes (
void)
const;
115 int get_num_levels (
void)
const;
122 void get_samples_per_level (std::vector<std::size_t>* stats)
const;
125 void node_center_and_size (
Iterator const& iter,
129 Node const* get_root_node (
void)
const;
132 math::Vec3d const& get_root_node_center (
void)
const;
135 double get_root_node_size (
void)
const;
138 Iterator get_iterator_for_root (
void)
const;
145 void influence_query (
math::Vec3d const& pos,
double factor,
146 std::vector<Sample const*>* result)
const;
151 void refine_octree (
void);
157 void limit_octree_level (
void);
163 void set_max_level (
int max_level);
169 int get_max_level (
void)
const;
172 void print_stats (std::ostream& out);
176 void create_children (
Node* node);
178 void expand_root_for_point (
math::Vec3d const& pos);
182 Node* find_node_expand (
Sample const& sample);
183 int get_num_levels (
Node const* node)
const;
184 void get_samples_per_level (std::vector<std::size_t>* stats,
185 Node const* node, std::size_t level)
const;
186 void influence_query (
math::Vec3d const& pos,
double factor,
187 std::vector<Sample const*>* result,
Iterator const& iter,
189 void limit_octree_level (
Node* node,
Node* parent,
int level);
198 std::size_t num_samples;
199 std::size_t num_nodes;
208Octree::Node::Node (
void)
209 : children(nullptr), parent(nullptr)
216 delete [] this->children;
249 this->root =
nullptr;
250 this->root_size = 0.0;
252 this->num_samples = 0;
254 this->max_level = 20;
263 this->num_samples = 0;
269 return this->num_samples;
275 return this->num_nodes;
300 return this->root_center;
306 return this->root_size;
311 std::vector<Sample const*>* result)
const
321 this->max_level = std::max(0, std::min(20, max_level));
327 return this->max_level;
A regular octree data structure (each node has zero or eight child nodes).
void clear(void)
Resets the octree to its initial state.
void get_samples_per_level(std::vector< std::size_t > *stats) const
Returns octree level statistics (WARNING: traverses whole tree).
int get_max_level(void) const
Returns the maximum level on which voxels are generated.
void influence_query(math::Vec3d const &pos, double factor, std::vector< Sample const * > *result) const
Queries all samples that influence the given point.
math::Vec3d const & get_root_node_center(void) const
Returns the center of the root node.
void set_max_level(int max_level)
Sets the maximum level on which voxels are generated.
double get_root_node_size(void) const
Returns the size of the root node.
std::size_t get_num_nodes(void) const
Returns the number of nodes in the octree.
Iterator get_iterator_for_root(void) const
Returns an octree iterator for the root.
void clear_samples(void)
Clears all samples in all nodes.
int get_num_levels(void) const
Returns the number of levels (WARNING: traverses whole tree).
Node const * get_root_node(void) const
Returns the root node (read-only).
std::size_t get_num_samples(void) const
Returns the number of samples in the octree.
#define FSSR_NAMESPACE_END
#define FSSR_NAMESPACE_BEGIN
std::vector< Sample > SampleList
Representation of a list of samples.
Vector< double, 3 > Vec3d
Octree iterator that keeps track of level and path through the octree.
Simple recursive octree node that stores samples in a vector.
std::vector< Sample > samples
Representation of a point sample.