Space Comps
 All Classes Files Functions Variables
octree.h
1 #ifndef OCTREE_H
2 #define OCTREE_H
3 #include "boundingbox.h"
4 
10 class Octree
11 {
12 public:
26  Octree(int levelIn,
27  double nwfXIn, double nwfYIn, double nwfZIn,
28  double sebXIn, double sebYIn, double sebZIn);
29  ~Octree();
30 
36  void clear();
37 
43  void split();
44 
52  int getIndex(Particle* particle);
53 
60  void insertToTree(Particle* particle);
61 
70  std::vector<Particle*>* getPossibleColliders(std::vector<Particle*> *colliders, Particle* particle);
71 
72 
73 private:
74  int maxParticles;
75  int maxLevels;
76  int level;
77  std::vector<Particle*> nodeParticles;
78  double nwfX;
79  double nwfY;
80  double nwfZ;
81  double sebX;
82  double sebY;
83  double sebZ;
84  Octree* nodes [8];
85 };
86 
87 #endif // OCTREE_H
std::vector< Particle * > * getPossibleColliders(std::vector< Particle * > *colliders, Particle *particle)
Returns a vector of Particles that may be colliding with a given Particle.
Definition: octree.cpp:169
void split()
Splits the Octree into 8 octants.
Definition: octree.cpp:46
void clear()
Clears the Octree.
Definition: octree.cpp:34
int getIndex(Particle *particle)
Gets the index of a given Particle within a Octree.
Definition: octree.cpp:62
The Octree data structure used in OctreeAlgorithm.
Definition: octree.h:10
Octree(int levelIn, double nwfXIn, double nwfYIn, double nwfZIn, double sebXIn, double sebYIn, double sebZIn)
Constructs a Octree object.
Definition: octree.cpp:4
Definition: particle.h:12
void insertToTree(Particle *particle)
Inserts a given Particle into a Octree.
Definition: octree.cpp:129