geolib2
OctreeNode.h
Go to the documentation of this file.
1 #ifndef GEOLIB_OCTREENODE_H_
2 #define GEOLIB_OCTREENODE_H_
3 
4 #include "datatypes.h"
5 
6 #include <vector>
7 
8 namespace geo {
9 
10 class Octree;
11 
12 class OctreeNode {
13 
14 public:
15 
16  OctreeNode(double size, Octree* octree);
17 
18  OctreeNode(const OctreeNode& orig, Octree* tree);
19 
20  virtual ~OctreeNode();
21 
22  OctreeNode* clone(Octree* tree) const;
23 
24  void add(const Vector3& p);
25 
26  void getCubes(std::vector<Box>& cubes, const Vector3& offset) const;
27 
28  bool intersect(const Ray& r, float t0, float t1, double& distance, const Vector3& offset) const;
29 
30  void raytrace(const Vector3& o, const Vector3& dir, float t0, float t1, const Vector3& offset);
31 
32  bool contains(const Vector3& p) const;
33 
34  bool intersect(const Box& b) const;
35 
36 protected:
37 
38  double size_;
39 
40  double split_;
41 
43 
44  bool occupied_;
45 
47 
48 };
49 
50 }
51 
52 #endif
geo::OctreeNode
Definition: OctreeNode.h:12
geo::OctreeNode::split_
double split_
Definition: OctreeNode.h:40
geo::OctreeNode::~OctreeNode
virtual ~OctreeNode()
Definition: OctreeNode.cpp:25
geo
Definition: Box.h:6
geo::OctreeNode::add
void add(const Vector3 &p)
Definition: OctreeNode.cpp:31
vector
geo::Box
Definition: Box.h:15
geo::OctreeNode::occupied_
bool occupied_
Definition: OctreeNode.h:44
datatypes.h
geo::OctreeNode::tree_
Octree * tree_
Definition: OctreeNode.h:46
geo::OctreeNode::children_
OctreeNode * children_[8]
Definition: OctreeNode.h:42
geo::OctreeNode::raytrace
void raytrace(const Vector3 &o, const Vector3 &dir, float t0, float t1, const Vector3 &offset)
Definition: OctreeNode.cpp:116
geo::Ray
Definition: Ray.h:10
geo::OctreeNode::clone
OctreeNode * clone(Octree *tree) const
geo::Vector3
Definition: matrix.h:12
geo::Octree
Definition: Octree.h:12
geo::OctreeNode::getCubes
void getCubes(std::vector< Box > &cubes, const Vector3 &offset) const
Definition: OctreeNode.cpp:55
geo::OctreeNode::size_
double size_
Definition: OctreeNode.h:38
b
void b()
geo::OctreeNode::intersect
bool intersect(const Ray &r, float t0, float t1, double &distance, const Vector3 &offset) const
Definition: OctreeNode.cpp:74
geo::OctreeNode::OctreeNode
OctreeNode(double size, Octree *octree)
Definition: OctreeNode.cpp:7
geo::OctreeNode::contains
bool contains(const Vector3 &p) const
Definition: OctreeNode.cpp:150