The BoundingBox class represents a square or cube that fits perfectly around a particle. More...
#include <boundingbox.h>
Public Member Functions | |
BoundingBox (Particle *p) | |
Constructs a BoundingBox around the given Particle. More... | |
Particle * | getParticle () |
Returns the Particle this BouningBox is tracks the endpoints of. More... | |
void | update () |
Updates the position of the BouningBox to reflect the Particle. More... | |
double | getMax (int dimension) |
Returns the minimum of the desired dimension. More... | |
double | getMin (int dimension) |
Returns the maximum of the desired dimension. More... | |
double | getXMin () |
Returns the minimum x dimension coordinate of this BoundingBox. More... | |
double | getXMax () |
Returns the maximum x dimension coordinate of this BouningBox. More... | |
double | getYMin () |
Returns the minimum y dimension coordinate of this BoundingBox. More... | |
double | getYMax () |
Returns the maximum y dimension coordinate of this BouningBox. More... | |
double | getZMin () |
Returns the minimum z dimension coordinate of this BoundingBox. More... | |
double | getZMax () |
Returns the maximum z dimension coordinate of this BouningBox. More... | |
bool | pointContained3D (double point[3]) |
Returns whether a point in 3-space falls within this BoundingBox. More... | |
bool | boxOverlap3D (BoundingBox *other) |
Returns whether or not 2 bouning boxes overlap (in 3-space) More... | |
bool | pointContained2D (double point[2]) |
Returns whether a point in 2-space falls within this BoundingBox. More... | |
bool | boxOverlap2D (BoundingBox *other) |
Returns whether or not 2 bouning boxes overlap (in 3-space) More... | |
The BoundingBox class represents a square or cube that fits perfectly around a particle.
This class is mostly a convenient way of tracking the endpoints or extreemes of a Particle in each dimentsion.
BoundingBox::BoundingBox | ( | Particle * | p | ) |
Constructs a BoundingBox around the given Particle.
This tells the BoundingBox what Particle it is responsible for, and sets the appropriate minimum and maximum values for each dimension.
p | the Particle this BoundingBox is responsible for. |
bool BoundingBox::boxOverlap2D | ( | BoundingBox * | other | ) |
Returns whether or not 2 bouning boxes overlap (in 3-space)
If any corner of either of the BoundingBoxes lies within the other BoundingBox, then they overlap, if this is true for no corners, then they do not overlap. This requires us to check all 16 corners.
other | the BouningBox to check against this one for overlap. |
bool BoundingBox::boxOverlap3D | ( | BoundingBox * | other | ) |
Returns whether or not 2 bouning boxes overlap (in 3-space)
If any corner of either of the BoundingBoxes lies within the other BoundingBox, then they overlap, if this is true for no corners, then they do not overlap. This requires us to check all 16 corners.
other | the BouningBox to check against this one for overlap. |
double BoundingBox::getMax | ( | int | dimension | ) |
Returns the minimum of the desired dimension.
This returns the minimum coordinate of this BoundingBox in the desired dimension. This is mostly a glorified and generalized getter.
dimension | the desired from: X_DIMENSION, Y_DIMENSION, Z_DIMENSION |
double BoundingBox::getMin | ( | int | dimension | ) |
Returns the maximum of the desired dimension.
This returns the maximum coordinate of this BoundingBox in the desired dimension. This is mostly a glorified and generalized getter.
dimension | the desired from: X_DIMENSION, Y_DIMENSION, Z_DIMENSION |
Particle * BoundingBox::getParticle | ( | ) |
Returns the Particle this BouningBox is tracks the endpoints of.
double BoundingBox::getXMax | ( | ) |
Returns the maximum x dimension coordinate of this BouningBox.
double BoundingBox::getXMin | ( | ) |
Returns the minimum x dimension coordinate of this BoundingBox.
double BoundingBox::getYMax | ( | ) |
Returns the maximum y dimension coordinate of this BouningBox.
double BoundingBox::getYMin | ( | ) |
Returns the minimum y dimension coordinate of this BoundingBox.
double BoundingBox::getZMax | ( | ) |
Returns the maximum z dimension coordinate of this BouningBox.
double BoundingBox::getZMin | ( | ) |
Returns the minimum z dimension coordinate of this BoundingBox.
bool BoundingBox::pointContained2D | ( | double | point[2] | ) |
Returns whether a point in 2-space falls within this BoundingBox.
Ensures the x coordinate of the point lies between this BouningBox's x minimum and x maximum, and does the same for the y dimension.
point | a point in 2-space |
bool BoundingBox::pointContained3D | ( | double | point[3] | ) |
Returns whether a point in 3-space falls within this BoundingBox.
Ensures the x coordinate of the point lies between this BouningBox's x minimum and x maximum, and does the same for the y and z dimensions.
point | a point in 3-space |
void BoundingBox::update | ( | ) |