The Octree data structure used in OctreeAlgorithm. More...
#include <octree.h>
Public Member Functions | |
Octree (int levelIn, double nwfXIn, double nwfYIn, double nwfZIn, double sebXIn, double sebYIn, double sebZIn) | |
Constructs a Octree object. More... | |
void | clear () |
Clears the Octree. More... | |
void | split () |
Splits the Octree into 8 octants. More... | |
int | getIndex (Particle *particle) |
Gets the index of a given Particle within a Octree. More... | |
void | insertToTree (Particle *particle) |
Inserts a given Particle into a Octree. More... | |
std::vector< Particle * > * | getPossibleColliders (std::vector< Particle * > *colliders, Particle *particle) |
Returns a vector of Particles that may be colliding with a given Particle. More... | |
The Octree data structure used in OctreeAlgorithm.
A Octree represents a cubic section of space defined in the X,Y,Z coordinate system.
Octree::Octree | ( | int | levelIn, |
double | nwfXIn, | ||
double | nwfYIn, | ||
double | nwfZIn, | ||
double | sebXIn, | ||
double | sebYIn, | ||
double | sebZIn | ||
) |
Constructs a Octree object.
Constructs a Octree object based on the given parameters.
levelIn | the level of the Octree object within the larger tree. The head of the tree is 0 and increases with each subsequent tree. |
nwXIn | the X coordinate of the upper left corner of the space represented by this level of the tree. |
nwYIn | the Y coordinate of the upper left corner of the space represented by this level of the tree. |
nwZIn | the Z coordinate of the upper left corner of the space represented by this level of the tree. |
seXIn | the X coordinate of the bottom right corner of the space represented by this level of the tree. |
seYIn | the Y coordinate of the bottom right corner of the space represented by this level of the tree. |
seZIn | the Z coordinate of the bottom right corner of the space represented by this level of the tree. |
void Octree::clear | ( | ) |
int Octree::getIndex | ( | Particle * | particle | ) |
Gets the index of a given Particle within a Octree.
Gets the index of a given Particle within a Octree. An index of -1 means the Particle cannot fit completely within any of the 8 nodes. An index of 0, 1, 2, 3, 4, 5, 6, or 7 means the particle fits completely within the cooresponding node.
particle | pointer to the Particle to get an index of. |
std::vector< Particle * > * Octree::getPossibleColliders | ( | std::vector< Particle * > * | colliders, |
Particle * | particle | ||
) |
Returns a vector of Particles that may be colliding with a given Particle.
Returns a pointer to the vector of pointers to Particles that may be colliding with a given Particle.
colliders | pointer to the vector of Particles that may be colliding with a given Particle. |
p | pointer to the given Particle to check against. |
void Octree::insertToTree | ( | Particle * | particle | ) |
void Octree::split | ( | ) |